Changeset 2966


Ignore:
Timestamp:
06/22/10 17:26:23 (14 years ago)
Author:
alexandrecorreia
Message:

Ticket #1116 - Melhorar a visualizacao/avisos de novos contatos e pedidos de autorizacao no modulo.

Location:
trunk/jmessenger
Files:
6 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/jmessenger/js/jscode/loadIM.js

    r2954 r2966  
    22{ 
    33        var _autoStatus; 
    4         var _autoStatusTime     = 60000; // 1 minuto     
    5         var addUser                             = null; 
    6         var conn                                = null; 
    7         var fullName                    = ""; 
    8         var path                                = ""; 
    9         var _preferencesIM              = ""; 
    10         var selectEditable              = null; 
    11         var showhidden                  = null; 
    12         var _statusMessage              = ""; 
    13         var timeoutId                   = null; 
    14         var userCurrent                 = null; 
    15         var Xtools                              = null; 
    16         var zIndex                              = 9001; 
    17         var windowPopUp                 = []; 
     4        var _autoStatusTime             = 60000; // 1 minuto 
     5        var addUser                                     = null; 
     6        var conn                                        = null; 
     7        var fullName                            = ""; 
     8        var path                                        = ""; 
     9        var _preferencesIM                      = ""; 
     10        var selectEditable                      = null; 
     11        var showhidden                          = null; 
     12        var statusUserIM                        = ""; 
     13        var _statusMessage                      = ""; 
     14        var timeoutId                           = null; 
     15        var userCurrent                         = null; 
     16        var _timeOutNotification        = ""; 
     17        var Xtools                                      = null; 
     18        var zIndex                                      = 9001; 
     19        var windowPopUp                         = []; 
    1820         
    1921        // Sniffer Browser 
     
    245247 
    246248                                _div_status.setAttribute('autoStatus','true'); 
     249                                 
    247250                                loadscript.setStatusJabber("Não Disponível","xa"); 
    248251                        } 
     
    797800                        // Photo User 
    798801                        getPhotoUser(_idUser); 
    799                          
    800802                } 
    801803                 
     
    829831 
    830832                        case 'none' : 
    831                          
     833                                 
    832834                                TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribe'); 
    833835                                TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribed'); 
     
    851853                                         
    852854                        case 'to' : 
    853                                  
     855 
    854856                                TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribed'); 
    855857                                         
     
    859861                                 
    860862                                        break; 
     863                                         
     864                                default : 
     865                                         
     866                                        alert( "DEFAULT : " + subscription ); 
    861867                } 
    862868        }        
     
    10461052                        { 
    10471053                                var _text       = arguments[0]; 
    1048                                 var _img        = arguments[1]; 
    1049  
     1054                                var _img        = statusUserIM = arguments[1]; 
     1055                                 
    10501056                                getElement('statusJabberText').innerHTML                = _text; 
    10511057                                getElement('statusJabberImg').style.background  = "url('"+path_jabberit+"templates/default/images/"+_img+".gif')"; 
     
    11461152                } 
    11471153        } 
     1154         
     1155        function windowNotificationNewUsers() 
     1156        { 
     1157                var paramsNotification =  
     1158                { 
     1159                        'lang_1' : "Notificação",        
     1160                        'lang_2' : "O(s) usuário(s) abaixo pedem sua autorização."       
     1161                }; 
     1162                 
     1163                var winLoginPage = 
     1164                {        
     1165                         id_window              : "window_notification_new_users", 
     1166                         width                  : 350, 
     1167                         height                 : 300, 
     1168                         top                    : 100, 
     1169                         left                   : 400, 
     1170                         draggable              : true, 
     1171                         visible                : "display", 
     1172                         resizable              : true, 
     1173                         zindex                 : zIndex++, 
     1174                         title                  : "Expresso Messenger - Notificação de Novos Usuários", 
     1175                         closeAction    : "remove", 
     1176                         content                : Xtools.parse(Xtools.xml("notification_new_users"), "notificationNewUsers.xsl", paramsNotification)     
     1177                }; 
     1178 
     1179                _winBuild( winLoginPage ); 
     1180        } 
     1181         
     1182        function teste_new() 
     1183        { 
     1184                var _notification       = getElement('notification_new_users_jabber') ; 
     1185                var _statusJabber       = getElement('status_jabber_expresso'); 
     1186         
     1187                if( _notification && _statusJabber ) 
     1188                {        
     1189                        if ( _notification.style.display == 'none' ) 
     1190                        { 
     1191                                _notification.style.display = 'block'; 
     1192                                 
     1193                                _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/alert_mini.png') no-repeat"; 
     1194                                 
     1195                                if( _timeOutNotification ) 
     1196                                        clearTimeout(_timeOutNotification ); 
     1197 
     1198                                _timeOutNotification = setTimeout( function(){ teste_new(); }, 2000 ); 
     1199                        } 
     1200                        else 
     1201                        { 
     1202                                _notification.style.display = 'none'; 
     1203                                 
     1204                                _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/" + statusUserIM + ".gif') no-repeat"; 
     1205                                 
     1206                                if( _timeOutNotification ) 
     1207                                        clearTimeout(_timeOutNotification ); 
     1208 
     1209                                _timeOutNotification = setTimeout( function(){ teste_new(); }, 800 ); 
     1210                        } 
     1211                } 
     1212        } 
     1213         
     1214         
     1215        loadIM.prototype.teste_new = teste_new; 
     1216         
    11481217         
    11491218        function loadIM() 
     
    12041273                                { 
    12051274                                        if( _preferencesIM[0] === 'openWindowJabberit:true' ) 
     1275                                        { 
    12061276                                                TrophyIM.load(); 
     1277                                        } 
     1278                                         
    12071279                                },1500); 
    12081280                                 
     
    12491321        loadIM.prototype.renameGroup            = renameGroup; 
    12501322        loadIM.prototype.rosterDiv                      = rosterDiv; 
     1323        loadIM.prototype.windowNotificationNewUsers  = windowNotificationNewUsers; 
    12511324        loadIM.prototype.windowPOPUP            = windowPOPUP; 
     1325         
    12521326         
    12531327        window.LoadIM = loadIM; 
  • trunk/jmessenger/js/trophyim.js

    r2961 r2966  
    130130 */ 
    131131TrophyIM = { 
     132                 
     133 
     134        controll : { notificationNewUsers : 0 },         
     135                 
    132136     
    133137        /** AutoConnection 
     
    11771181                        if( arguments.length > 0 ) 
    11781182                        { 
     1183                                // Get Arguments 
    11791184                                var objContact  = arguments[0]; 
    11801185                                var group               = arguments[1]; 
     
    11831188                                var showOffline = loadscript.getShowContactsOffline(); 
    11841189                                 
    1185                                 var itensJid    = document.getElementById( 'itenContact_' + objContact.contact.jid + '_' + index ); 
     1190                                // Presence e Status 
     1191                                var presence            = "unavailable"; 
     1192                                var status                      = ""; 
     1193                                var statusColor         = "black"; 
     1194                                var statusDisplay       = "none"; 
     1195                                 
     1196                                // Set Presence  
     1197                                var _presence = function(objContact) 
     1198                                { 
     1199                                        if (objContact.presence) 
     1200                                        { 
     1201                                                for (var resource in objContact.presence) 
     1202                                                { 
     1203                                                        if ( objContact.presence[resource].constructor == Function ) 
     1204                                                                continue; 
     1205 
     1206                                                        if( objContact.presence[resource].show != 'invisible' ) 
     1207                                                                presence = objContact.presence[resource].show; 
     1208 
     1209                                                        if( objContact.contact.subscription != "both")  
     1210                                                                presence = 'subscription'; 
     1211                                                         
     1212                                                        if( objContact.presence[resource].status ) 
     1213                                                        { 
     1214                                                                status = " ( " + objContact.presence[resource].status + " ) "; 
     1215                                                                statusDisplay   = "block"; 
     1216                                                        } 
     1217                                                } 
     1218                                        } 
     1219                                }; 
     1220                                 
     1221                                // Set Subscription 
     1222                                var _subscription = function( objContact ) 
     1223                                { 
     1224                                        if( objContact.contact.subscription != "both" ) 
     1225                                        { 
     1226                                                switch( objContact.contact.subscription ) 
     1227                                                { 
     1228                                                        case "none" : 
     1229                                                                 
     1230                                                                status          = " (( " + i18n.ASK_FOR_AUTH  + " )) "; 
     1231                                                                statusColor     = "red"; 
     1232                                                                break; 
     1233         
     1234                                                        case "to" : 
     1235                                                                 
     1236                                                                status          = " (( " + i18n.CONTACT_ASK_FOR_AUTH  + " )) "; 
     1237                                                                statusColor     = "orange"; 
     1238                                                                 
     1239                                                                if ( TrophyIM.controll.notificationNewUsers == 0 )  
     1240                                                                { 
     1241                                                                        loadscript.teste_new(); 
     1242                                                                        TrophyIM.controll.notificationNewUsers++; 
     1243                                                                } 
     1244                                                                 
     1245                                                                break; 
     1246         
     1247                                                        case "from" : 
     1248                                                                 
     1249                                                                status          = " (( " + i18n.AUTH_ASK + " )) "; 
     1250                                                                statusColor = "green"; 
     1251                                                                break; 
     1252                                                                 
     1253                                                        case "subscribe" :  
     1254                                                                 
     1255                                                                status          = " (( " + i18n.AUTH_SENT  + " )) "; 
     1256                                                                statusColor     = "red";         
     1257                                                                break; 
     1258 
     1259                                                        case "not-in-roster" : 
     1260                                                                 
     1261                                                                status          = " (( " + i18n.ASK_FOR_AUTH_QUESTION  + " )) "; 
     1262                                                                statusColor     = "orange";      
     1263                                                                 
     1264                                                                if ( TrophyIM.controll.notificationNewUsers == 0 )  
     1265                                                                { 
     1266                                                                        loadscript.teste_new(); 
     1267                                                                        TrophyIM.controll.notificationNewUsers++; 
     1268                                                                } 
     1269 
     1270                                                                break; 
     1271                                                                 
     1272                                                        default: 
     1273                                                                paramsContact.status = " ( SEM PARAMETRO DEFINIDO" + objContact.contact.subscription + " ) "; 
     1274                                                } 
     1275 
     1276                                                statusDisplay = "block"; 
     1277                                        } 
     1278                                }; 
     1279 
     1280                                var itensJid    = document.getElementById( "itenContact_" + objContact.contact.jid + "_" + index ); 
    11861281 
    11871282                                if( itensJid == null ) 
     
    11981293                                        } 
    11991294                                         
    1200                                         // Presence e Status 
    1201                                         var presence            = "unavailable"; 
    1202                                         var status                      = ""; 
    1203                                         var statusDisplay       = "none"; 
    1204                                          
    1205                                         if (objContact.presence) 
    1206                                         { 
    1207                                                 for (var resource in objContact.presence) 
    1208                                                 { 
    1209                                                         if ( objContact.presence[resource].constructor == Function ) 
    1210                                                                 continue; 
    1211  
    1212                                                         if( objContact.presence[resource].show != 'invisible' ) 
    1213                                                                 presence = objContact.presence[resource].show; 
    1214  
    1215                                                         if( objContact.contact.subscription != "both")  
    1216                                                                 presence = 'subscription'; 
    1217                                                          
    1218                                                         if( objContact.presence[resource].status ) 
    1219                                                         { 
    1220                                                                 status = " ( " + objContact.presence[resource].status + " ) "; 
    1221                                                                 statusDisplay   = "block"; 
    1222                                                         } 
    1223                                                 } 
    1224                                         } 
     1295                                        // Get Presence 
     1296                                        _presence(objContact); 
    12251297                                         
    12261298                                        var paramsContact = 
     
    12391311                                        } 
    12401312                                         
    1241                                         // Authorization         
    1242                                         if( objContact.contact.subscription != "both" ) 
    1243                                         { 
    1244                                                  
    1245                                                 switch(objContact.contact.subscription) 
    1246                                                 { 
    1247                                                         case "none" : 
    1248                                                                                                                            
    1249                                                                 paramsContact.status            = " (( " + i18n.ASK_AUTHO + " )) "; 
    1250                                                                 paramsContact.statusColor       = "red"; 
    1251                                                                 break; 
    1252          
    1253                                                         case "to" : 
    1254                                                                  
    1255                                                                 paramsContact.status            = " (( " + i18n.CONTACT_ASK_FOR_AUTH + ")) "; 
    1256                                                                 paramsContact.statusColor       = "orange"; 
    1257                                                                 break; 
    1258          
    1259                                                         case "from" : 
    1260                                                                  
    1261                                                                 paramsContact.status            = " (( " + i18n.AUTH_ASK + " )) "; 
    1262                                                                 paramsContact.statusColor       = "green"; 
    1263                                                                 break; 
    1264                                                                  
    1265                                                         case "subscribe" :  
    1266                                                                  
    1267                                                                 paramsContact.status            =  " (( " + i18n.AUTH_SENT + " )) "; 
    1268                                                                 paramsContact.statusColor       = "red";         
    1269                                                                 break; 
    1270  
    1271                                                         case "not-in-roster" : 
    1272                                                                  
    1273                                                                 paramsContact.status            = " (( " + i18n.ASK_FOR_AUTH_QUESTION + " )) "; 
    1274                                                                 paramsContact.statusColor       = "orange";      
    1275                                                                 break; 
    1276                                                                  
    1277                                                         default: 
    1278                                                                 paramsContact.status = " ( " + objContact.contact.subscription + " ) "; 
    1279                                                 } 
    1280                                         } 
     1313                                        // Get Authorization 
     1314                                        _subscription( objContact ); 
    12811315                                         
    12821316                                        if( group != "") 
     
    13001334                                else 
    13011335                                { 
    1302  
    1303                                         // Presence e Status 
    1304                                         var presence            = "unavailable"; 
    1305                                         var status                      = ""; 
    1306                                         var statusColor         = "black"; 
    1307                                         var statusDisplay       = "none"; 
    1308                                          
    1309                                         if ( objContact.presence ) 
    1310                                         { 
    1311                                                 for ( var resource in objContact.presence ) 
    1312                                                 { 
    1313                                                         if ( objContact.presence[resource].constructor == Function ) 
    1314                                                                 continue; 
    1315  
    1316                                                         if( objContact.presence[resource].show != 'invisible' ) 
    1317                                                                 presence = objContact.presence[resource].show; 
    1318  
    1319                                                         if( objContact.contact.subscription != "both") 
    1320                                                                 presence = 'subscription'; 
    1321                                                          
    1322                                                         if( objContact.presence[resource].status ) 
    1323                                                         { 
    1324                                                                 status = " ( " + objContact.presence[resource].status + " ) "; 
    1325                                                                 statusDisplay   = "block"; 
    1326                                                         } 
    1327                                                 }        
    1328                                         } 
    1329                                                  
     1336                                        // Get Presence 
     1337                                        _presence(objContact); 
     1338 
    13301339                                        var is_open = itensJid.parentNode.childNodes[0].style.backgroundImage;   
    13311340                                                is_open = is_open.indexOf("arrow_down.gif"); 
    13321341                                         
    1333                                         // Authorization         
    1334                                         if( objContact.contact.subscription != "both" ) 
    1335                                         { 
    1336                                                 switch(objContact.contact.subscription) 
    1337                                                 { 
    1338                                                         case "none" : 
    1339                                                                  
    1340                                                                 status          = " (( " + i18n.ASK_FOR_AUTH  + " )) "; 
    1341                                                                 statusColor     = "red"; 
    1342                                                                 break; 
    1343          
    1344                                                         case "to" : 
    1345                                                                  
    1346                                                                 status          = " (( " + i18n.CONTACT_ASK_FOR_AUTH  + " )) "; 
    1347                                                                 statusColor     = "orange"; 
    1348                                                                 break; 
    1349          
    1350                                                         case "from" : 
    1351                                                                  
    1352                                                                 status          = " (( " + i18n.AUTH_ASK + " )) "; 
    1353                                                                 statusColor = "green"; 
    1354                                                                 break; 
    1355                                                                  
    1356                                                         case "subscribe" :  
    1357                                                                  
    1358                                                                 status          = " (( " + i18n.AUTH_SENT  + " )) "; 
    1359                                                                 statusColor     = "red";         
    1360                                                                 break; 
    1361  
    1362                                                         case "not-in-roster" : 
    1363                                                                  
    1364                                                                 status          = " (( " + i18n.ASK_FOR_AUTH_QUESTION  + " )) "; 
    1365                                                                 statusColor     = "orange";      
    1366                                                                 break; 
    1367                                                                  
    1368                                                         default: 
    1369                                                                 status = " ( " + objContact.contact.subscription + " ) "; 
    1370                                                 } 
    1371  
    1372                                                 statusDisplay = "block"; 
    1373                                         } 
     1342                                        // Get Authorization 
     1343                                        _subscription( objContact ); 
    13741344                                         
    13751345                                        with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid + '_' + index ) ) 
     
    14171387                                } 
    14181388                        } 
    1419                 } 
     1389                }; 
    14201390                 
    14211391                for( var i = 0 ; i < users.length; i++ ) 
    14221392                { 
    1423                         if( TrophyIM.rosterObj.roster[users[i]].contact.jid != Base64.decode(loadscript.getUserCurrent().jid) ) 
     1393                        if( TrophyIM.rosterObj.roster[users[i]].contact.jid != Base64.decode( loadscript.getUserCurrent().jid) ) 
    14241394                        { 
    14251395                                if( TrophyIM.rosterObj.roster[users[i]].contact.groups ) 
     
    14441414                                } 
    14451415                        } 
    1446                 }        
     1416                } 
    14471417        }, 
    14481418 
  • trunk/jmessenger/xsl/contactsList.xsl

    r2896 r2966  
    1515                        <div style="position: absolute; left: 80px; top: 8px;"> <xsl:value-of select="$full_name"/> </div> 
    1616 
    17                         <div style="position: absolute; top: 28px; left: 80px;"> 
     17                        <div style="position: absolute; top: 25px; left: 80px;"> 
    1818                                <button style="width:35px;" alt="Adicionar Contatos" title="Adicionar Contatos" onclick="loadscript.addContact();"> 
    1919                                        <img src="{$path_jabberit}/templates/default/images/users.png"/> 
     
    2323                                 
    2424                                <img style="height:16px; margin-left:10px;cursor:pointer;" alt="Help" title="Help" src="{$path_jabberit}/templates/default/images/help.png" onclick="alert('2');" /> 
     25                         
     26                        </div> 
     27                         
     28                        <div id="notification_new_users_jabber" style="display:none; position:absolute; top: 25px; left: 165px;"> 
     29                                <img style="margin-left:15px;cursor:pointer;" alt="Novos Contatos" title="Novos Contatos" src="{$path_jabberit}/templates/default/images/alert_2.png" onclick="loadscript.windowNotificationNewUsers();" /> 
    2530                        </div> 
    2631 
Note: See TracChangeset for help on using the changeset viewer.