Changeset 2511 for sandbox/jabberit_messenger
- Timestamp:
- 04/13/10 17:48:28 (14 years ago)
- Location:
- sandbox/jabberit_messenger/trophy_expresso
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/jabberit_messenger/trophy_expresso/inc/WebService.php
r2471 r2511 12 12 class WebService 13 13 { 14 function __construct() 15 { 16 require_once("../../header.session.inc.php"); 17 } 18 19 public final function getPhoto($pUid) 20 { 21 require_once("class.LdapIM.inc.php"); 22 23 $ldap = new LdapIM(); 24 25 $uid = $pUid; 26 if( strpos($pUid, "/") ) 27 $uid = substr($pUid, 0, strpos($pUid, "/")); 28 29 $photo = $ldap->getPhotoUser($uid, true); 30 31 if ( !$photo ) 32 $photo = $ldap->getPhotoUser($uid, false); 33 34 if( $photo ) 35 $photo = imagecreatefromstring($photo); 36 else 37 $photo = imagecreatefrompng("../templates/default/images/photo.png"); 38 39 header("Content-Type: image/jpeg"); 40 $width = imagesx($photo); 41 $height = imagesy($photo); 42 $twidth = 60; 43 $theight = 80; 44 $small_photo = imagecreatetruecolor ($twidth, $theight); 45 imagecopyresampled($small_photo, $photo, 0, 0, 0, 0,$twidth, $theight, $width, $height); 46 imagejpeg($small_photo,'',100); 47 48 return; 49 } 50 14 51 public final function getPhotoSession($pUid, $pOu) 15 52 { … … 17 54 if( strpos($pUid, "@") ) 18 55 $uid = substr($pUid, 0, strpos($pUid, "@")); 19 20 require_once("../../header.session.inc.php");21 56 22 57 if( isset($_SESSION['phpgw_info']['jabberit_messenger']['photo'][$pOu][$uid]) ) … … 40 75 } 41 76 42 // Ph p - fotos pelo php;43 if(trim($_REQUEST['ph pPhoto']) != "")77 // Photo in Session 78 if(trim($_REQUEST['photo_session']) != "") 44 79 { 45 80 $obj = new WebService(); 46 $ou = $_REQUEST[' phpOu'];47 $jid = $_REQUEST['ph pPhoto'];81 $ou = $_REQUEST['ou']; 82 $jid = $_REQUEST['photo_session']; 48 83 49 84 $obj->getPhotoSession($jid, $ou); 50 85 } 51 86 87 // Photo Ldap 88 if(trim($_REQUEST['photo_ldap'])) 89 { 90 $obj = new WebService(); 91 $jid = $_REQUEST['photo_ldap']; 92 $obj->getPhoto($jid); 93 } 52 94 53 95 ?> -
sandbox/jabberit_messenger/trophy_expresso/inc/class.LdapIM.inc.php
r2421 r2511 303 303 } 304 304 305 public final function getPhotoUser( $_uid, $ldapRoot ) 306 { 307 308 $uid = substr($_uid, 0, strpos($_uid, "@")); 309 $host = substr($_uid, (strpos($_uid, "@") + 1)); 310 311 if( $ldapRoot ) 312 { 313 $this->ldapRoot(); 314 } 315 else 316 { 317 $confHosts = $this->hostsJabber; 318 319 for( $i = 0; $i < count($confHosts); $i++ ) 320 { 321 if( trim($host) === trim($confHosts[$i]['jabberName']) ) 322 { 323 $this->ldap_host = $confHosts[$i]['serverLdap']; 324 $this->ldap_context = $confHosts[$i]['contextLdap']; 325 $this->ldap_user = $confHosts[$i]['user']; 326 $this->ldap_org = $confHosts[$i]['org']; 327 $this->ldap_pass = $confHosts[$i]['password']; 328 $this->ldap = $this->ldapCatalog(); 329 } 330 } 331 } 332 333 if( $this->ldap ) 334 { 335 $filter = "(&(phpgwaccounttype=u)(uid=".$uid."))"; 336 $justthese = array($this->attribute, "uidNumber", "phpgwAccontVisible", "dn", "jpegPhoto"); 337 $search = ldap_search( $this->ldap, $this->ldap_context, $filter, $justthese, 0, $this->max_result + 1); 338 $entry = ldap_get_entries( $this->ldap, $search ); 339 340 for( $i = 0 ; $i < $entry['count']; $i++ ) 341 { 342 if( $entry[$i]['jpegphoto'][0] && $entry[$i]['phpgwaccountvisible'][0] != '-1' ) 343 { 344 $filterPhoto = "(objectclass=*)"; 345 $photoLdap = ldap_read($this->ldap, $entry[$i]['dn'], $filterPhoto, array("jpegPhoto")); 346 $firstEntry = ldap_first_entry($this->ldap, $photoLdap); 347 $photo = ldap_get_values_len($this->ldap, $firstEntry, "jpegPhoto"); 348 349 if( $this->ldap ) 350 ldap_close($this->ldap); 351 352 return $photo[0]; 353 } 354 } 355 } 356 357 return false; 358 } 359 305 360 public final function getUsersLdapCatalog( $search, $uid = false, $pLdap = false ) 306 361 { -
sandbox/jabberit_messenger/trophy_expresso/js/AddUser.js
r2471 r2511 57 57 58 58 var _img_path = path_jabberit + 'inc/WebService.php?' + Date.parse( new Date ); 59 _img_path += '&ph pPhoto=' + jid + '&phpOu=' + ou;59 _img_path += '&photo_session=' + jid + '&ou=' + ou; 60 60 61 61 _newUser.style.backgroundImage = 'url(' + _img_path + ')'; -
sandbox/jabberit_messenger/trophy_expresso/js/loadIM.js
r2491 r2511 167 167 _optionsItens.setAttribute("style", "margin: 20px 0px 0px -4px;"); 168 168 _optionsItens.className = "x-menu"; 169 _optionsItens.style.zIndex = '99999 ';169 _optionsItens.style.zIndex = '999999'; 170 170 _optionsItens.innerHTML = _itens; 171 171 … … 182 182 { 183 183 return document.getElementById( elementId ); 184 } 185 186 function getPhotoUser( jid ) 187 { 188 var _divPhoto = getElement( jid + '__photo' ); 189 190 if( _divPhoto.style.backgroundImage.indexOf('photo.png') > 0 ) 191 { 192 var _imgUser = path_jabberit + 'inc/WebService.php?' + Date.parse( new Date ); 193 _imgUser += '&photo_ldap=' + jid; 194 195 _divPhoto.style.backgroundImage = 'url(' + _imgUser + ')'; 196 } 184 197 } 185 198 … … 332 345 _optionsItens.setAttribute("style", "margin: -10px 0px 0px 20px;"); 333 346 _optionsItens.className = "x-menu"; 334 _optionsItens.style.zIndex = '99999';347 _optionsItens.style.zIndex = zIndex++; 335 348 _optionsItens.innerHTML = _itens; 336 349 _optionsItens.onmouseout = function(){ showhidden.hiddenObject(false); }; … … 373 386 var paramListContact = 374 387 { 388 'idUser' : getUserCurrent().jid, 389 'full_name' : (( fullName.length < 25 ) ? fullName : ( fullName.substring( 0, 25) + "...")), 375 390 'path_jabberit' : path_jabberit, 376 ' full_name' : (( fullName.length < 25 ) ? fullName : ( fullName.substring( 0, 25) + "..."))391 'zIndex_' : zIndex++ 377 392 }; 378 393 … … 394 409 395 410 _winBuild( winRosterDiv ); 411 412 // Photo User 413 getPhotoUser(getUserCurrent().jid); 396 414 } 397 415 … … 442 460 ['Não Disponível', 'xa', '<img src="'+path_jabberit+'templates/default/images/xa.gif" />'], 443 461 ['Ocupado', 'dnd', '<img src="'+path_jabberit+'templates/default/images/dnd.gif" />'], 462 ['Mensagem de Status...', 'status', '<img src="'+path_jabberit+'templates/default/images/message_normal.gif" />'] 444 463 ]; 445 464 … … 477 496 if( arguments.length > 0 ) 478 497 { 479 var _text = arguments[0]; 480 var _img = arguments[1]; 481 482 getElement('statusJabberImg').setAttribute("style", "background-image: url('"+path_jabberit+"templates/default/images/"+_img+".gif'); margin-left: 13px;width:15px; height:15px;"); 483 getElement('statusJabberText').innerHTML = _text; 484 getElement('status_jabber_expresso').style.background = "url('"+path_jabberit+"templates/default/images/"+_img+".gif') no-repeat"; 498 if( arguments[1] != 'status' ) 499 { 500 var _text = arguments[0]; 501 var _img = arguments[1]; 502 503 getElement('statusJabberImg').setAttribute("style", "background-image: url('"+path_jabberit+"templates/default/images/"+_img+".gif'); margin-left: 13px;width:15px; height:15px;"); 504 getElement('statusJabberText').innerHTML = _text; 505 getElement('status_jabber_expresso').style.background = "url('"+path_jabberit+"templates/default/images/"+_img+".gif') no-repeat"; 506 } 485 507 } 486 508 } … … 550 572 loadIM.prototype.addContact = addContact; 551 573 loadIM.prototype.configEvents = configEvents; 574 loadIM.prototype.getPhotoUser = getPhotoUser; 552 575 loadIM.prototype.getUserCurrent = getUserCurrent; 553 576 loadIM.prototype.getZIndex = getZindex; -
sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js
r2491 r2511 656 656 'path_jabberit' : path_jabberit 657 657 }; 658 658 659 titleWindow = barejid.toLowerCase(); 660 titleWindow = titleWindow.substring(0, titleWindow.indexOf('@')); 661 659 662 if( TrophyIM.rosterObj.roster[barejid] ) 660 663 { … … 664 667 } 665 668 } 666 else667 {668 titleWindow = barejid.toLowerCase();669 titleWindow = titleWindow.substring(0, titleWindow.indexOf('@'));670 }671 669 672 670 var winChatBox = … … 687 685 688 686 _winBuild(winChatBox); 687 688 // Photo User; 689 loadIM.getPhotoUser(barejid); 689 690 690 691 loadIM.configEvents( document.getElementById( barejid + '__sendBox'), … … 999 1000 for( var i = 0 ; i < users.length; i++ ) 1000 1001 { 1001 if( TrophyIM.rosterObj.roster[users[i]].contact.groups ) 1002 { 1003 var groups = TrophyIM.rosterObj.roster[users[i]].contact.groups; 1004 1005 if( groups.length > 0 ) 1002 if( TrophyIM.rosterObj.roster[users[i]].contact.jid != loadIM.getUserCurrent().jid ) 1003 { 1004 if( TrophyIM.rosterObj.roster[users[i]].contact.groups ) 1006 1005 { 1007 for( var j = 0; j < groups.length; j++ ) 1008 addItem( TrophyIM.rosterObj.roster[users[i]], groups[j], element, j ); 1006 var groups = TrophyIM.rosterObj.roster[users[i]].contact.groups; 1007 1008 if( groups.length > 0 ) 1009 { 1010 for( var j = 0; j < groups.length; j++ ) 1011 addItem( TrophyIM.rosterObj.roster[users[i]], groups[j], element, j ); 1012 } 1013 else 1014 { 1015 addItem( TrophyIM.rosterObj.roster[users[i]], "Geral", element, 0 ); 1016 } 1009 1017 } 1010 1018 else … … 1013 1021 } 1014 1022 } 1015 else1016 {1017 addItem( TrophyIM.rosterObj.roster[users[i]], "Geral", element, 0 );1018 }1019 1023 } 1020 1024 }, … … 1046 1050 */ 1047 1051 1048 setPresence : function( show ) 1049 { 1050 TrophyIM.connection.send($pres( ).c('show').t(show).tree()); 1052 setPresence : function( type ) 1053 { 1054 if( type != 'status') 1055 { 1056 TrophyIM.connection.send($pres( ).c('show').t(type).tree()); 1057 } 1058 else 1059 { 1060 var _show = "available"; 1061 var _status = ""; 1062 1063 if (( _status = prompt("Digite sua mensagem !") )) 1064 { 1065 for(var resource in TrophyIM.rosterObj.roster[loadIM.getUserCurrent().jid].presence ) 1066 { 1067 if ( TROPHYIM_RESOURCE === ("/" + resource) ) 1068 _show = TrophyIM.rosterObj.roster[loadIM.getUserCurrent().jid].presence[resource].show; 1069 } 1070 1071 var _presence = $pres( ); 1072 _presence.node.appendChild( Strophe.xmlElement( 'show' ) ).appendChild( Strophe.xmlTextNode( _show ) ); 1073 _presence.node.appendChild( Strophe.xmlElement( 'status' ) ).appendChild( Strophe.xmlTextNode( _status ) ); 1074 1075 TrophyIM.connection.send( _presence.tree() ); 1076 } 1077 } 1051 1078 }, 1052 1079 … … 1157 1184 this.addContact = function(jid, subscription, name, groups ) 1158 1185 { 1159 if( jid != loadIM.getUserCurrent().jid ) 1160 { 1161 if( subscription !== "remove" ) 1162 { 1163 var contact = { jid:jid, subscription:subscription, name:name, groups:groups } 1164 var jid_lower = jid.toLowerCase(); 1165 1166 if ( this.roster[jid_lower] ) 1186 if( subscription !== "remove" ) 1187 { 1188 var contact = { jid:jid, subscription:subscription, name:name, groups:groups } 1189 var jid_lower = jid.toLowerCase(); 1190 1191 if ( this.roster[jid_lower] ) 1192 { 1193 this.roster[jid_lower]['contact'] = contact; 1194 } 1195 else 1196 { 1197 this.roster[jid_lower] = {contact:contact}; 1198 } 1199 1200 groups = groups ? groups : ['']; 1201 1202 for ( var g = 0; g < groups.length; g++ ) 1203 { 1204 if ( !this.groups[groups[g]] ) 1167 1205 { 1168 this.roster[jid_lower]['contact'] = contact; 1169 } 1170 else 1171 { 1172 this.roster[jid_lower] = {contact:contact}; 1173 } 1174 1175 groups = groups ? groups : ['']; 1176 1177 for ( var g = 0; g < groups.length; g++ ) 1178 { 1179 if ( !this.groups[groups[g]] ) 1180 { 1181 this.groups[groups[g]] = {}; 1182 } 1183 1184 this.groups[groups[g]][jid_lower] = jid_lower; 1185 } 1206 this.groups[groups[g]] = {}; 1207 } 1208 1209 this.groups[groups[g]][jid_lower] = jid_lower; 1186 1210 } 1187 else1188 {1189 this.removeContact(jid);1190 }1211 } 1212 else 1213 { 1214 this.removeContact(jid); 1191 1215 } 1192 1216 } … … 1314 1338 var jid_lower = barejid.toLowerCase(); 1315 1339 1316 if( barejid != loadIM.getUserCurrent().jid ) 1317 { 1318 if( show != 'unavailable') 1319 { 1320 if (!this.roster[jid_lower]) 1321 { 1322 this.addContact(barejid, 'not-in-roster'); 1323 } 1324 var presence = 1325 { 1326 resource:resource, priority:priority, show:show, status:status 1327 } 1328 1329 if (!this.roster[jid_lower]['presence']) 1330 { 1331 this.roster[jid_lower]['presence'] = {} 1332 } 1333 this.roster[jid_lower]['presence'][resource] = presence 1334 } 1335 else if (this.roster[jid_lower] && this.roster[jid_lower]['presence'] && this.roster[jid_lower]['presence'][resource]) 1336 { 1337 delete this.roster[jid_lower]['presence'][resource]; 1338 } 1339 1340 this.addChange(jid_lower); 1341 1342 if (TrophyIM.activeChats['divs'][jid_lower]) 1343 { 1344 TrophyIM.setTabPresence(jid_lower, TrophyIM.activeChats['divs'][jid_lower]['tab']); 1345 } 1346 } 1340 if( show != 'unavailable') 1341 { 1342 if (!this.roster[jid_lower]) 1343 { 1344 this.addContact(barejid, 'not-in-roster'); 1345 } 1346 var presence = 1347 { 1348 resource:resource, priority:priority, show:show, status:status 1349 } 1350 1351 if (!this.roster[jid_lower]['presence']) 1352 { 1353 this.roster[jid_lower]['presence'] = {} 1354 } 1355 this.roster[jid_lower]['presence'][resource] = presence 1356 } 1357 else if (this.roster[jid_lower] && this.roster[jid_lower]['presence'] && this.roster[jid_lower]['presence'][resource]) 1358 { 1359 delete this.roster[jid_lower]['presence'][resource]; 1360 } 1361 1362 this.addChange(jid_lower); 1347 1363 } 1348 1364 -
sandbox/jabberit_messenger/trophy_expresso/xsl/chatBox.xsl
r2437 r2511 13 13 <div style="margin:2px;"> 14 14 <textarea id="{$jidTo}__sendBox" class="trophyimchatinput" style="padding-left: 78px; height:130px; width:360px;"></textarea> 15 <div style="position:relative;margin:-126px 0 0 3px;width:60px ;height:80px ;background-image:url('{$path_jabberit}templates/default/images/photo.png');"></div> 16 15 <div id="{$jidTo}__photo" style="position:relative;margin:-126px 0 0 3px;width:60px ;height:80px ;background-image:url('{$path_jabberit}templates/default/images/photo.png');" /> 17 16 <div style="margin: 5px;"> 18 17 <input type="button" value="Send" onclick="TrophyIM.sendMessage('{$jidTo}')"/> -
sandbox/jabberit_messenger/trophy_expresso/xsl/contactsList.xsl
r2491 r2511 3 3 <xsl:output method="html" omit-xml-declaration="yes"/> 4 4 5 <xsl:param name="idUser"/> 6 <xsl:param name="full_name" /> 5 7 <xsl:param name="path_jabberit" /> 6 <xsl:param name=" full_name" />8 <xsl:param name="zIndex_" /> 7 9 8 10 <xsl:template match="contacts_list"> 9 11 10 12 <fieldset style="margin:2px; border:1px dotted #000000; height: 90px;"> 11 <div style="margin:0px; width:60px; height:80px; background-image:url('{$path_jabberit}/templates/default/images/photo.png');"/> 12 13 <div id="{$idUser}__photo" style="margin:0px; width:60px; height:80px; background-image:url('{$path_jabberit}/templates/default/images/photo.png');"/> 13 14 <div style="position: absolute; margin-top: -19px; margin-left: 75px; cursor: pointer;" onclick="loadIM.setPresence(this);"> 14 15 <div id="statusJabberImg" style="background-image: url('{$path_jabberit}/templates/default/images/available.gif'); margin-left: 13px;width:15px; height:15px;"></div> … … 25 26 </fieldset> 26 27 27 <div id="JabberIMRoster" style="margin-top:3px;overflow-y: auto; height: 267px; "></div>28 <div id="JabberIMRoster" style="margin-top:3px;overflow-y: auto; height: 267px; z-index:{$zIndex_};"></div> 28 29 29 30 </xsl:template>
Note: See TracChangeset
for help on using the changeset viewer.