[3102] | 1 | (function() |
---|
| 2 | { |
---|
| 3 | var _autoStatusTime = 60000; // 1 minuto |
---|
| 4 | var _autoStatus; |
---|
| 5 | var _conn = new JITConnector(path_jabberit); |
---|
[5041] | 6 | var Xtools = new xtools(path_jabberit); |
---|
[3102] | 7 | var _showhidden = new ShowHidden(300); |
---|
| 8 | var _win_contacts = null; |
---|
| 9 | var myWindow = null; |
---|
| 10 | var flagMouseOver = ''; |
---|
| 11 | var flagOpenIM = ''; |
---|
| 12 | var flagOpenPopup = ''; |
---|
| 13 | var flagAwayIM = ''; |
---|
| 14 | var itensSubMenu = []; |
---|
| 15 | |
---|
| 16 | // Sniffer Browser |
---|
| 17 | var agt = navigator.userAgent.toLowerCase(); |
---|
| 18 | var is_major = parseInt(navigator.appVersion); |
---|
| 19 | var is_minor = parseFloat(navigator.appVersion); |
---|
| 20 | var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) |
---|
| 21 | && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) |
---|
| 22 | && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)); |
---|
| 23 | var is_gecko = (agt.indexOf('gecko') != -1); |
---|
| 24 | var is_gecko1_5 = (agt.indexOf('firefox/1.5') != -1 || agt.indexOf('firefox/2') != -1 || agt.indexOf('iceweasel/2') != -1); |
---|
| 25 | var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)); |
---|
| 26 | var is_ie3 = (is_ie && (is_major < 4)); |
---|
| 27 | var is_ie4 = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) ); |
---|
| 28 | var is_ie4up = (is_ie && (is_major >= 4)); |
---|
| 29 | var is_ie5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) ); |
---|
| 30 | var is_ie5_5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1)); |
---|
| 31 | var is_ie5up = (is_ie && !is_ie3 && !is_ie4); |
---|
| 32 | var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5); |
---|
| 33 | var is_ie6 = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) ); |
---|
| 34 | var is_ie6up = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5); |
---|
| 35 | var is_win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) ); |
---|
| 36 | |
---|
| 37 | var _ldap = new JITLdap( _conn, Xtools, is_ie ); |
---|
| 38 | |
---|
| 39 | function addContacts() |
---|
| 40 | { |
---|
| 41 | _ldap.load(myWindow); |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | function addIcon() |
---|
| 45 | { |
---|
| 46 | |
---|
| 47 | var StatusBar = document.getElementById('divStatusBar'); |
---|
| 48 | |
---|
| 49 | /** |
---|
| 50 | * @quando estiver habilitada a opção fora de escritório nos filtros. |
---|
| 51 | */ |
---|
| 52 | |
---|
| 53 | if( div_write_msg = document.getElementById('em_div_write_msg') ) |
---|
| 54 | { |
---|
| 55 | var StatusBarIM = document.getElementById('JabberMessenger'); |
---|
| 56 | div_write_msg.parentNode.insertBefore(StatusBarIM, div_write_msg); |
---|
| 57 | StatusBarIM.style.paddingLeft = '33px'; |
---|
| 58 | return; |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | if( StatusBar ) |
---|
| 62 | { |
---|
| 63 | StatusBar.style.paddingLeft = '33px'; |
---|
| 64 | |
---|
| 65 | var _div = document.createElement('div'); |
---|
| 66 | _div.appendChild(StatusBar.parentNode.removeChild(StatusBar.previousSibling)); |
---|
| 67 | StatusBar.parentNode.insertBefore(_div,StatusBar); |
---|
| 68 | |
---|
| 69 | var divJabber = document.createElement('div'); |
---|
| 70 | divJabber.setAttribute('id', 'JabberMessenger'); |
---|
| 71 | |
---|
| 72 | var _status = top.document.createElement('div'); |
---|
| 73 | _status.setAttribute('id', 'jabberit_login'); |
---|
| 74 | _status.style.background = 'no-repeat'; |
---|
| 75 | _status.style.backgroundImage = 'url(' + jabberit_group_open.src + ')'; |
---|
| 76 | _status.style.float = 'left'; |
---|
| 77 | _status.style.height = '15px'; |
---|
| 78 | _status.style.left = '7px'; |
---|
| 79 | _status.style.margin = '8 0 0 10px'; |
---|
| 80 | _status.style.padding = '0px'; |
---|
| 81 | _status.style.position = 'absolute'; |
---|
| 82 | _status.style.width = '15px'; |
---|
| 83 | _status.style.cursor = 'pointer'; |
---|
| 84 | |
---|
| 85 | divJabber.insertBefore(_status,divJabber.firstChild); |
---|
| 86 | |
---|
| 87 | var _menu; |
---|
| 88 | _menu = top.document.createElement('div'); |
---|
| 89 | _menu.setAttribute('id','fast_menu_jabberit'); |
---|
| 90 | _menu.className = "x-menu"; |
---|
| 91 | _menu.style.zIndex = '99999'; |
---|
| 92 | _menu.onmouseout = function(){ _showhidden.hiddenObject(false); }; |
---|
| 93 | _menu.onmouseover = function(){ _showhidden.hiddenObject(true); }; |
---|
| 94 | |
---|
| 95 | divJabber.insertBefore(_menu, divJabber.firstChild); |
---|
| 96 | |
---|
| 97 | var _menu_div = top.document.createElement('div'); |
---|
| 98 | _menu_div.setAttribute('id','status_Jabber_Expresso'); |
---|
| 99 | _menu_div.style.background = 'no-repeat'; |
---|
| 100 | _menu_div.style.backgroundImage = 'url(' + jabberit_add_user.src + ')'; |
---|
| 101 | _menu_div.style.float = 'left'; |
---|
| 102 | _menu_div.style.height = '18px'; |
---|
| 103 | _menu_div.style.left = '19px'; |
---|
| 104 | _menu_div.style.margin = '0 0 0 10px'; |
---|
| 105 | _menu_div.style.padding = '0px'; |
---|
| 106 | _menu_div.style.position = 'absolute'; |
---|
| 107 | _menu_div.style.width = '18px'; |
---|
| 108 | _menu_div.style.cursor = 'pointer'; |
---|
| 109 | _menu_div.style.zindex = '999999'; |
---|
| 110 | |
---|
| 111 | statusJabberExpresso = _menu_div; |
---|
| 112 | |
---|
| 113 | divJabber.insertBefore(_menu_div, divJabber.firstChild); |
---|
| 114 | StatusBar.insertBefore(divJabber, StatusBar.firstChild); |
---|
| 115 | |
---|
| 116 | configEvents(_menu_div,'onclick', windowShow); |
---|
[5183] | 117 | configEvents( _status, 'onclick', function(){fastMenu(_status);}); |
---|
| 118 | } |
---|
| 119 | } |
---|
[5320] | 120 | |
---|
[5183] | 121 | function fastMenu() |
---|
[5320] | 122 | { |
---|
[5183] | 123 | if( arguments.length > 0 ) |
---|
| 124 | { |
---|
| 125 | var element = arguments[0]; |
---|
| 126 | |
---|
[5320] | 127 | var _options = [ |
---|
[5183] | 128 | ['Add Contact', 'loadscript.addContacts();'], |
---|
| 129 | ['Help', 'loadscript.helpJabberit();'], |
---|
| 130 | ['Preferences', 'loadscript.preferences();'] |
---|
[5320] | 131 | ]; |
---|
| 132 | |
---|
[5183] | 133 | var _itens = ""; |
---|
[5320] | 134 | |
---|
[5183] | 135 | for( var i in _options ) |
---|
[5320] | 136 | { |
---|
[5183] | 137 | if( _options[i].constructor == Function ) |
---|
| 138 | continue; |
---|
[5320] | 139 | |
---|
[5183] | 140 | _itens += '<img src="'+jabberit_group_close.src +'"/>'; |
---|
| 141 | _itens += '<span style="cursor:pointer; margin:3px;" onclick='+_options[i][1]+'>'; |
---|
| 142 | _itens += jabberitGetLang( _options[i][0] ) + '</span><br/>'; |
---|
| 143 | } |
---|
| 144 | |
---|
| 145 | var _optionsItens = document.createElement("div"); |
---|
| 146 | _optionsItens.id = "fastMenu_Jabber"; |
---|
| 147 | _optionsItens.style.marginTop = "19px"; |
---|
| 148 | _optionsItens.style.marginLeft = "-8px"; |
---|
| 149 | _optionsItens.className = "x-menu"; |
---|
| 150 | _optionsItens.style.zIndex = '999999'; |
---|
| 151 | _optionsItens.innerHTML = _itens; |
---|
| 152 | _optionsItens.onclick = function(){ |
---|
| 153 | _showhidden.hiddenObject(false); |
---|
| 154 | }; |
---|
[5320] | 155 | |
---|
[5183] | 156 | _optionsItens.onmouseout = function(){ |
---|
| 157 | _showhidden.hiddenObject(false); |
---|
| 158 | }; |
---|
[5320] | 159 | |
---|
[5183] | 160 | _optionsItens.onmouseover = function(){ |
---|
| 161 | _showhidden.hiddenObject(true); |
---|
| 162 | }; |
---|
[5320] | 163 | |
---|
[5183] | 164 | _showhidden.action('onmouseover', 'onmouseout', _optionsItens); |
---|
[5320] | 165 | |
---|
[5183] | 166 | element.parentNode.appendChild( _optionsItens ); |
---|
[5320] | 167 | } |
---|
| 168 | } |
---|
[3102] | 169 | |
---|
[5320] | 170 | function addUser() |
---|
[3102] | 171 | { |
---|
| 172 | _ldap.addUser(); |
---|
| 173 | } |
---|
| 174 | |
---|
| 175 | function autoStatus() |
---|
| 176 | { |
---|
| 177 | if ( _autoStatus ) |
---|
| 178 | clearTimeout(_autoStatus); |
---|
| 179 | |
---|
| 180 | var _div_status = document.getElementById('status_Jabber_Expresso'); |
---|
| 181 | if ( _div_status ) |
---|
| 182 | { |
---|
| 183 | var _status = _div_status.style.backgroundImage; |
---|
| 184 | _status = _status.substr(_status.lastIndexOf('/') + 1); |
---|
| 185 | _status = _status.substr(0, _status.indexOf('.')); |
---|
| 186 | if ( _status == 'xa' && _div_status.getAttribute('autoStatus') ) |
---|
| 187 | { |
---|
| 188 | _div_status.removeAttribute('autoStatus'); |
---|
| 189 | changeStatusJava("2"); |
---|
| 190 | } |
---|
| 191 | } |
---|
| 192 | |
---|
| 193 | var TimeStatus = flagAwayIM.split(':'); |
---|
| 194 | |
---|
| 195 | if( TimeStatus[1] ) |
---|
| 196 | _autoStatus = setTimeout(autoStatusHandler, parseInt(TimeStatus[1])*_autoStatusTime); |
---|
| 197 | else |
---|
| 198 | _autoStatus = setTimeout(autoStatusHandler, parseInt(_autoStatusTime)); |
---|
| 199 | } |
---|
| 200 | |
---|
| 201 | function autoStatusHandler() |
---|
| 202 | { |
---|
| 203 | var _div_status = document.getElementById('status_Jabber_Expresso'); |
---|
| 204 | if ( _div_status ) |
---|
| 205 | { |
---|
| 206 | var _status = _div_status.style.backgroundImage; |
---|
| 207 | _status = _status.substr(_status.lastIndexOf('/') + 1); |
---|
| 208 | _status = _status.substr(0, _status.indexOf('.')); |
---|
| 209 | if ( _status == 'available' ) |
---|
| 210 | { |
---|
| 211 | _div_status.setAttribute('autoStatus','true'); |
---|
| 212 | changeStatusJava("5"); |
---|
| 213 | } |
---|
| 214 | } |
---|
| 215 | } |
---|
| 216 | |
---|
| 217 | function changeStatusJava() |
---|
| 218 | { |
---|
| 219 | if(arguments.length > 0 ) |
---|
| 220 | { |
---|
| 221 | try |
---|
| 222 | { |
---|
| 223 | var status = arguments[0]; |
---|
| 224 | var msg = ( arguments[1] ) ? arguments[1] : ""; |
---|
| 225 | |
---|
| 226 | // If Layer; |
---|
| 227 | if( elementIframe = document.getElementById('iframe_applet_jabberit') ) |
---|
| 228 | { |
---|
| 229 | if( !is_ie ) |
---|
| 230 | elementIframe.contentDocument.applets[0].changeStatusfromExpresso(status, msg); |
---|
| 231 | else |
---|
| 232 | elementIframe.contentWindow.document.applets[0].changeStatusfromExpresso(status, msg); |
---|
| 233 | } |
---|
| 234 | else // If Pop-Up |
---|
| 235 | { |
---|
| 236 | myWindow.document.applets[0].changeStatusfromExpresso(status, msg); |
---|
| 237 | } |
---|
| 238 | |
---|
| 239 | } |
---|
| 240 | catch(e) |
---|
| 241 | { |
---|
| 242 | if( confirm('Deseja conectar o IM ?') ) |
---|
| 243 | windowShow(); |
---|
| 244 | } |
---|
| 245 | } |
---|
| 246 | } |
---|
| 247 | |
---|
| 248 | function configEvents(pObj, pEvent, pHandler) |
---|
| 249 | { |
---|
| 250 | if ( typeof pObj == 'object' ) |
---|
| 251 | { |
---|
| 252 | if ( pEvent.substring(0, 2) == 'on' ) |
---|
| 253 | pEvent = pEvent.substring(2, pEvent.length ); |
---|
| 254 | |
---|
| 255 | if ( arguments.length == 3 ) |
---|
| 256 | { |
---|
| 257 | if ( pObj.addEventListener ) |
---|
| 258 | pObj.addEventListener(pEvent, pHandler, false ); |
---|
| 259 | else if ( pObj.attachEvent ) |
---|
| 260 | pObj.attachEvent( 'on' + pEvent, pHandler ); |
---|
| 261 | } |
---|
| 262 | else if ( arguments.length == 4 ) |
---|
| 263 | { |
---|
| 264 | if ( pObj.removeEventListener ) |
---|
| 265 | pObj.removeEventListener( pEvent, pHandler, false ); |
---|
| 266 | else if ( pObj.detachEvent ) |
---|
| 267 | pObj.detachEvent( 'on' + pEvent, pHandler ); |
---|
| 268 | } |
---|
| 269 | } |
---|
| 270 | } |
---|
| 271 | |
---|
| 272 | function closeWindow() |
---|
| 273 | { |
---|
| 274 | var url_img = path_jabberit + 'templates/default/images/unavailable.gif'; |
---|
| 275 | var elementStatus = getElementStatus('status_Jabber_Expresso'); |
---|
| 276 | |
---|
| 277 | elementStatus.style.backgroundImage = 'url(' + url_img +')'; |
---|
| 278 | |
---|
| 279 | myWindow = null; |
---|
| 280 | } |
---|
| 281 | |
---|
| 282 | function getElementStatus() |
---|
| 283 | { |
---|
| 284 | return document.getElementById('status_Jabber_Expresso'); |
---|
| 285 | } |
---|
| 286 | |
---|
| 287 | function getPreferences() |
---|
| 288 | { |
---|
| 289 | if( flagOpenIM == '' ) |
---|
| 290 | { |
---|
| 291 | _conn.go("$this.preferences.getPreferences", |
---|
| 292 | function(data) |
---|
| 293 | { |
---|
| 294 | var autoConnect = ''; |
---|
| 295 | flagOpenIM = data; |
---|
| 296 | |
---|
| 297 | if( data.indexOf(';') != -1) |
---|
| 298 | { |
---|
| 299 | var temp = data.split(';'); |
---|
| 300 | autoConnect = flagOpenIM = temp[0]; |
---|
| 301 | |
---|
| 302 | // Open as Pop-Up |
---|
| 303 | flagOpenPopup = 'openWindowJabberitPopUp:false'; |
---|
| 304 | |
---|
| 305 | if( temp[1] ) |
---|
| 306 | { |
---|
| 307 | if( temp[1] == 'openWindowJabberitPopUp:true' || temp[1] == 'openWindowJabberitPopUp:false') |
---|
| 308 | flagOpenPopup = temp[1]; |
---|
| 309 | } |
---|
| 310 | |
---|
| 311 | // Away |
---|
| 312 | flagAwayIM = 'flagAwayIM:5'; |
---|
| 313 | |
---|
| 314 | if( temp[2] ) |
---|
| 315 | { |
---|
| 316 | flagAwayIM = temp[2]; |
---|
| 317 | } |
---|
| 318 | } |
---|
| 319 | else |
---|
| 320 | { |
---|
| 321 | autoConnect = flagOpenIM; |
---|
| 322 | } |
---|
| 323 | |
---|
| 324 | if( autoConnect == 'openWindowJabberit:true' ) |
---|
| 325 | { |
---|
| 326 | setTimeout('loadscript.windowHidden();', 2500); |
---|
| 327 | } |
---|
| 328 | }); |
---|
| 329 | } |
---|
| 330 | |
---|
| 331 | } |
---|
| 332 | |
---|
| 333 | function helpJabberit() |
---|
| 334 | { |
---|
| 335 | var myWindowHelp = window.open( path_jabberit + 'help.php', 'HelpjabberIM', 'width=800,height=495,top=50,left=50,scrollbars=yes'); |
---|
| 336 | } |
---|
| 337 | |
---|
| 338 | function keyPressSearch() |
---|
| 339 | { |
---|
| 340 | var ev = arguments[0]; |
---|
| 341 | var element = arguments[1]; |
---|
| 342 | |
---|
| 343 | if ( ev.keyCode == 13 ) |
---|
| 344 | if( element.value.length >= 4 ) |
---|
| 345 | _ldap.search( element.value ); |
---|
| 346 | else |
---|
| 347 | alert(jabberitGetLang('Your search argument must be longer than 4 characters.')); |
---|
| 348 | } |
---|
| 349 | |
---|
| 350 | function openPopup() |
---|
| 351 | { |
---|
| 352 | var widPopup = '220'; |
---|
| 353 | |
---|
| 354 | if( is_ie ) |
---|
| 355 | widPopup = '250'; |
---|
| 356 | |
---|
| 357 | try{ |
---|
| 358 | |
---|
| 359 | if( myWindow == null ) |
---|
| 360 | { |
---|
| 361 | myWindow = window.open('','JabberIM','width='+widPopup+',height=400,top=50,left=50,toolbar=0,menubar=0,resizable=0,scrollbars=0,status=0,location=0,titlebar=0'); |
---|
| 362 | myWindow.close(); |
---|
| 363 | myWindow = window.open(path_jabberit + 'client.php','JabberIM','width='+widPopup+',height=400,top=50,left=50,toolbar=0,menubar=0,resizable=0,scrollbars=0,status=0,location=0,titlebar=0'); |
---|
| 364 | myWindow.blur(); |
---|
| 365 | configEvents( myWindow, 'onbeforeunload', closeWindow ); |
---|
| 366 | } |
---|
| 367 | else |
---|
| 368 | { |
---|
| 369 | for( var i = 15 ; i > 0 ; i-- ) |
---|
| 370 | { |
---|
| 371 | myWindow.moveBy(i,0); myWindow.moveBy(-i,0); |
---|
| 372 | } |
---|
| 373 | myWindow.focus(); |
---|
| 374 | } |
---|
| 375 | } |
---|
| 376 | catch(e) |
---|
| 377 | { |
---|
| 378 | delete myWindow; |
---|
| 379 | myWindow = window.open(path_jabberit + 'client.php','JabberIM','width='+widPopup+',height=400,top=50,left=50,toolbar=0,menubar=0,resizable=0,scrollbars=0,status=0,location=0,titlebar=0'); |
---|
| 380 | myWindow.blur(); |
---|
| 381 | configEvents( myWindow, 'onbeforeunload', closeWindow ); |
---|
| 382 | } |
---|
| 383 | } |
---|
| 384 | |
---|
| 385 | function openWindow() |
---|
| 386 | { |
---|
| 387 | if( document.getElementById(_win_contacts.id_window + "__content") == null ) |
---|
| 388 | { |
---|
| 389 | |
---|
| 390 | var _params = { |
---|
| 391 | 'path' : path_jabberit, |
---|
| 392 | 'width' : ( is_ie ) ? '100%' : '220px' |
---|
| 393 | }; |
---|
| 394 | |
---|
| 395 | _win_contacts.content = Xtools.parse(Xtools.xml('contacts_jabberit'), 'contacts_jabberit.xsl', _params ); |
---|
| 396 | |
---|
| 397 | winBuild( _win_contacts ); |
---|
| 398 | } |
---|
| 399 | } |
---|
| 400 | |
---|
| 401 | function preferences() |
---|
| 402 | { |
---|
| 403 | var _params = { |
---|
| 404 | 'path' : path_jabberit, |
---|
| 405 | 'lang1' : jabberitGetLang('Your Preferences'), |
---|
| 406 | 'lang2' : jabberitGetLang('Connection'), |
---|
| 407 | 'lang3' : jabberitGetLang('Enable Auto Login IM'), |
---|
| 408 | 'lang4' : jabberitGetLang('Users OffLine'), |
---|
| 409 | 'lang5' : jabberitGetLang('Show friends Offline'), |
---|
| 410 | 'lang6' : jabberitGetLang('Save'), |
---|
| 411 | 'lang7' : jabberitGetLang('Cancel'), |
---|
| 412 | 'lang8' : jabberitGetLang('Window'), |
---|
| 413 | 'lang9' : jabberitGetLang('Open as Pop-Up Window'), |
---|
| 414 | 'lang10' : jabberitGetLang('Away'), |
---|
| 415 | 'lang11' : jabberitGetLang('Set status to away after'), |
---|
| 416 | 'lang12' : jabberitGetLang('minutes'), |
---|
| 417 | 'langYes': jabberitGetLang('Yes'), |
---|
| 418 | 'langNo' : jabberitGetLang('No') |
---|
| 419 | }; |
---|
| 420 | |
---|
| 421 | var _win_preferences = { |
---|
| 422 | id_window : "jabberit_preferences", |
---|
| 423 | width : 430, |
---|
| 424 | height : 330, |
---|
| 425 | top : 150, |
---|
| 426 | left : 100, |
---|
| 427 | draggable : true, |
---|
| 428 | visible : "display", |
---|
| 429 | resizable : true, |
---|
| 430 | zindex : _ZINDEX++, |
---|
| 431 | title : 'Expresso Messenger - ' + jabberitGetLang('Preferences'), |
---|
| 432 | closeAction : "remove", |
---|
| 433 | content : Xtools.parse(Xtools.xml('preferences_jabberit'), 'preferences_jabberit.xsl', _params) |
---|
| 434 | }; |
---|
| 435 | |
---|
| 436 | winBuild(_win_preferences); |
---|
| 437 | |
---|
| 438 | // Element openWindowJabberit |
---|
| 439 | var value1 = flagOpenIM.split(':'); |
---|
| 440 | var element1 = document.getElementById(value1[0]); |
---|
| 441 | var valueSelect1 = value1[1]; |
---|
| 442 | |
---|
| 443 | for(var i = 0; i < element1.options.length; i++) |
---|
| 444 | if( element1.options[i].value == valueSelect1 ) |
---|
| 445 | element1.options[i].selected = true; |
---|
| 446 | |
---|
| 447 | |
---|
| 448 | // Element openWindowJabberitPopUp |
---|
| 449 | var value2 = flagOpenPopup.split(':'); |
---|
| 450 | var element2 = document.getElementById(value2[0]); |
---|
| 451 | var valueSelect2 = value2[1]; |
---|
| 452 | |
---|
| 453 | for(var i = 0; i < element2.options.length; i++) |
---|
| 454 | if( element2.options[i].value == valueSelect2 ) |
---|
| 455 | element2.options[i].selected = true; |
---|
| 456 | |
---|
| 457 | // Element flagAwayIM |
---|
| 458 | var value3 = flagAwayIM.split(':'); |
---|
| 459 | var element3 = document.getElementById(value3[0]); |
---|
| 460 | element3.value = value3[1]; |
---|
| 461 | |
---|
| 462 | |
---|
| 463 | var _pButtons = |
---|
| 464 | { |
---|
| 465 | 'lang1' : jabberitGetLang('Save'), |
---|
| 466 | 'lang2' : jabberitGetLang('Close'), |
---|
| 467 | 'onclickClose' : 'winBuild("jabberit_preferences","remove");', |
---|
| 468 | 'onclickSubmit' : 'javascript:loadscript.setPrefe();' |
---|
| 469 | }; |
---|
| 470 | |
---|
| 471 | document.getElementById('buttons_preferences_jabberit').innerHTML = Xtools.parse(Xtools.xml('buttons_main'), 'buttons.xsl', _pButtons); |
---|
| 472 | |
---|
| 473 | } |
---|
| 474 | |
---|
| 475 | function searchUser() |
---|
| 476 | { |
---|
| 477 | var element = arguments[0].previousSibling; |
---|
| 478 | |
---|
| 479 | if( element.value.length >= 4 ) |
---|
| 480 | _ldap.search( element.value ); |
---|
| 481 | else |
---|
| 482 | alert(jabberitGetLang('Your search argument must be longer than 4 characters.')); |
---|
| 483 | } |
---|
| 484 | |
---|
| 485 | function setItensStatusMenu() |
---|
| 486 | { |
---|
| 487 | var applet = ""; |
---|
| 488 | |
---|
| 489 | try |
---|
| 490 | { |
---|
| 491 | // Layer |
---|
| 492 | if( elementIframe = document.getElementById('iframe_applet_jabberit') ) |
---|
| 493 | { |
---|
| 494 | if( !is_ie ) |
---|
| 495 | applet = elementIframe.contentDocument.applets[0]; |
---|
| 496 | else |
---|
| 497 | applet = elementIframe.contentWindow.document.applets[0]; |
---|
| 498 | } |
---|
| 499 | else // Pop-up |
---|
| 500 | { |
---|
| 501 | applet = myWindow.document.applets[0]; |
---|
| 502 | } |
---|
| 503 | |
---|
| 504 | for( i = 1; i < 6; i++ ) |
---|
| 505 | itensSubMenu[i] = applet.getStatusMessages(i); |
---|
| 506 | |
---|
| 507 | }catch(e){} |
---|
| 508 | } |
---|
| 509 | |
---|
| 510 | function setPreferences() |
---|
| 511 | { |
---|
| 512 | // Element openWindowJabberit |
---|
| 513 | var elementOpenW = document.getElementById('openWindowJabberit'); |
---|
| 514 | var value = ''; |
---|
| 515 | var flagReload = false; |
---|
| 516 | |
---|
| 517 | for(var i = 0 ; i < elementOpenW.options.length; i++) |
---|
| 518 | if( elementOpenW.options[i].selected == true) |
---|
| 519 | { |
---|
| 520 | value = 'preferences1=openWindowJabberit:' + elementOpenW.options[i].value; |
---|
| 521 | flagOpenIM = 'openWindowJabberit:' + elementOpenW.options[i].value; |
---|
| 522 | } |
---|
| 523 | |
---|
| 524 | // Element openWindowJabberitPopUp |
---|
| 525 | var elementOpenPop = document.getElementById('openWindowJabberitPopUp'); |
---|
| 526 | |
---|
| 527 | for(var i = 0; i < elementOpenPop.options.length; i++ ) |
---|
| 528 | if( elementOpenPop.options[i].selected == true ) |
---|
| 529 | { |
---|
| 530 | value += '&preferences2=openWindowJabberitPopUp:' + elementOpenPop.options[i].value; |
---|
| 531 | |
---|
| 532 | if( flagOpenPopup != 'openWindowJabberitPopUp:' + elementOpenPop.options[i].value) |
---|
| 533 | flagReload = true; |
---|
| 534 | |
---|
| 535 | flagOpenPopup = 'openWindowJabberitPopUp:' + elementOpenPop.options[i].value; |
---|
| 536 | } |
---|
| 537 | |
---|
| 538 | // Element flagAwayIM |
---|
| 539 | var elementFlagIM = document.getElementById('flagAwayIM'); |
---|
| 540 | |
---|
| 541 | if( elementFlagIM.value.length > 0 && parseInt(elementFlagIM.value) > 0 ) |
---|
| 542 | { |
---|
| 543 | flagAwayIM = 'flagAwayIM:' + elementFlagIM.value; |
---|
| 544 | value += '&preferences3=flagAwayIM:' + elementFlagIM.value; |
---|
| 545 | } |
---|
| 546 | else |
---|
| 547 | { |
---|
| 548 | alert(jabberitGetLang('Enter a value greater than or equal to 1!')); |
---|
| 549 | return false; |
---|
| 550 | } |
---|
| 551 | |
---|
| 552 | _conn.go('$this.preferences.setPreferences', |
---|
| 553 | function(data) |
---|
| 554 | { |
---|
| 555 | if(data == 'true') |
---|
| 556 | { |
---|
| 557 | if( flagReload ) |
---|
| 558 | { |
---|
| 559 | window.location.reload(); |
---|
| 560 | myWindow.close(); |
---|
| 561 | } |
---|
| 562 | } |
---|
| 563 | else{ alert(jabberitGetLang('Error saving your preferences!')); } |
---|
| 564 | |
---|
| 565 | winBuild('jabberit_preferences', 'remove'); |
---|
| 566 | }, |
---|
| 567 | value); |
---|
| 568 | } |
---|
| 569 | |
---|
| 570 | function windowConf(pLeft) |
---|
| 571 | { |
---|
| 572 | if( !is_ie ) |
---|
| 573 | var sizeW = { w : 234, h : 432 }; |
---|
| 574 | else |
---|
| 575 | var sizeW = { w : 264, h : 430 }; |
---|
| 576 | |
---|
| 577 | _win_contacts = { |
---|
| 578 | id_window : "jabberit_contacts", |
---|
| 579 | width : sizeW.w, |
---|
| 580 | height : sizeW.h, |
---|
| 581 | top : 60, |
---|
| 582 | left : -1500, |
---|
| 583 | leftOld : 50, |
---|
| 584 | draggable : true, |
---|
| 585 | visible : "display", |
---|
| 586 | resizable : true, |
---|
| 587 | zindex : _ZINDEX++, |
---|
| 588 | title : "Expresso Messenger", |
---|
| 589 | closeAction : "hidden", |
---|
| 590 | content : "" |
---|
| 591 | }; |
---|
| 592 | |
---|
| 593 | } |
---|
| 594 | |
---|
| 595 | function windowHidden() |
---|
| 596 | { |
---|
| 597 | if( _win_contacts == null ) |
---|
| 598 | { |
---|
| 599 | windowConf(-1500); |
---|
| 600 | windowContacts(); |
---|
| 601 | } |
---|
| 602 | else |
---|
| 603 | winBuild( _win_contacts.id_window , "display" ); |
---|
| 604 | } |
---|
| 605 | |
---|
| 606 | function windowShow() |
---|
| 607 | { |
---|
| 608 | if( _win_contacts == null ) |
---|
| 609 | { |
---|
| 610 | windowConf(70); |
---|
| 611 | windowContacts(); |
---|
| 612 | } |
---|
| 613 | else |
---|
| 614 | winBuild( _win_contacts.id_window , "display" ); |
---|
| 615 | } |
---|
| 616 | |
---|
| 617 | function windowContacts() |
---|
| 618 | { |
---|
| 619 | if( flagOpenPopup === 'openWindowJabberitPopUp:true' ) |
---|
| 620 | { |
---|
| 621 | openPopup(); |
---|
| 622 | } |
---|
| 623 | else |
---|
| 624 | { |
---|
| 625 | openWindow(); |
---|
| 626 | } |
---|
| 627 | } |
---|
| 628 | |
---|
| 629 | function Load() |
---|
| 630 | { |
---|
| 631 | addIcon(); |
---|
| 632 | getPreferences(); |
---|
| 633 | |
---|
| 634 | // AutoStatus Away |
---|
| 635 | autoStatus(); |
---|
| 636 | configEvents(document, 'onmousemove', autoStatus); |
---|
| 637 | configEvents(document, 'onkeypress', autoStatus); |
---|
| 638 | } |
---|
| 639 | |
---|
| 640 | Load.prototype.adIcon = addIcon; |
---|
[5183] | 641 | Load.prototype.addContacts = addContacts; |
---|
[3102] | 642 | Load.prototype.addUser = addUser; |
---|
| 643 | Load.prototype.autoStatusIM = autoStatus; |
---|
| 644 | Load.prototype.chgStatusJava = changeStatusJava; |
---|
| 645 | Load.prototype.closeW = closeWindow; |
---|
| 646 | Load.prototype.getElement = getElementStatus; |
---|
[5183] | 647 | Load.prototype.helpJabberit = helpJabberit; |
---|
[3102] | 648 | Load.prototype.keyPress = keyPressSearch; |
---|
| 649 | Load.prototype.openPopup = openPopup; |
---|
[5183] | 650 | Load.prototype.preferences = preferences; |
---|
[3102] | 651 | Load.prototype.search = searchUser; |
---|
| 652 | Load.prototype.setPrefe = setPreferences; |
---|
| 653 | Load.prototype.windowHidden = windowHidden; |
---|
| 654 | |
---|
| 655 | configEvents(window, 'onload', function(){ window.loadscript = new Load; }); |
---|
| 656 | |
---|
| 657 | })(); |
---|
| 658 | |
---|
| 659 | // Functions OnMouseOver e OnMouseOut |
---|
| 660 | |
---|
| 661 | function elementOnMouseOut() |
---|
| 662 | { |
---|
| 663 | if( arguments.length > 0 ) |
---|
| 664 | { |
---|
| 665 | var _element = arguments[0]; |
---|
| 666 | _element.style.backgroundColor = ''; |
---|
| 667 | _element.style.border = ''; |
---|
| 668 | if( !arguments[1] ) |
---|
| 669 | _element.className = ''; |
---|
| 670 | } |
---|
| 671 | } |
---|
| 672 | |
---|
| 673 | function elementOnMouseOver() |
---|
| 674 | { |
---|
| 675 | if( arguments.length > 0 ) |
---|
| 676 | { |
---|
| 677 | var _element = arguments[0]; |
---|
| 678 | _element.className = 'x-menuOnMouseOver'; |
---|
| 679 | } |
---|
| 680 | } |
---|