Changeset 318


Ignore:
Timestamp:
06/17/08 14:44:24 (16 years ago)
Author:
niltonneto
Message:

Commit feito pelo desenvolvedor (rodrigosouza).

Location:
trunk/instant_messenger
Files:
6 added
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/instant_messenger/client.php

    r305 r318  
    99                'jabber', 
    1010                'images', 
    11                 'client' 
     11                'cookies', 
     12                'client', 
     13                'preferences' 
    1214        ); 
    1315 
  • trunk/instant_messenger/inc/class.Ujabber.inc.php

    r311 r318  
    77        public final function __construct($pConnectionType = 'write') 
    88        { 
    9                 /*session_start(); 
    10  
    11                 $this->_user     = $_SESSION['phpgw_info']['instant_messenger']['user']; 
    12                 //$this->_user     = 'niltonneto';//$_SESSION['phpgw_info']['instant_messenger']['user']; 
    13                 //$this->_pass     = 'nine59ever';//$_SESSION['phpgw_info']['instant_messenger']['passwd']; 
    14                 //$this->_pass     = 'senha';//$_SESSION['phpgw_info']['instant_messenger']['passwd']; 
    15                 $this->_pass     = $_SESSION['phpgw_info']['instant_messenger']['passwd']; 
    16                 $this->_server   = $_SESSION['phpgw_info']['instant_messenger']['name_jabber']; 
    17                 $this->_port     = '8883';//$_SESSION['phpgw_info']['instant_messenger']['port_jabber']; 
    18                 $this->_resource = $_SESSION['phpgw_info']['instant_messenger']['resource_jabber']; 
    19                 //$webjabber       = 'im.pr.gov.br';//$_SESSION['phpgw_info']['instant_messenger']['webjabber']; 
    20                 $webjabber       = '10.15.22.236';//$_SESSION['phpgw_info']['instant_messenger']['webjabber']; 
    21  
    22                 session_write_close();*/ 
    23  
    249                try 
    2510                { 
     
    2914                        require_once dirname(__FILE__) . '/../instant_messenger.define.php'; 
    3015 
    31                         if ( !(defined('JABBER_URL') && defined('JABBER_RESOURCE')) ) 
     16                        if ( !(defined('IM_NAME_JABBER') && defined('IM_RESOURCE_JABBER')) ) 
    3217                                throw new Exception(__CLASS__ . '[ ERROR #2 ] : Jabber server is not cofigured'); 
    3318 
    34                         if ( !(defined('WEBJABBER_URL') && defined('WEBJABBER_PORT')) ) 
    35                                 throw new Exception(__CLASS__ . '[ ERROR #3 ] : Webabber server is not cofigured'); 
    36  
    37                         $this->_server = constant('JABBER_URL'); 
    38                         $this->_resource = constant('JABBER_RESOURCE'); 
    39  
    40                         $this->_port = constant('WEBJABBER_PORT'); 
     19                        if ( !(defined('IM_SERVER_WEBJABBER') && defined('IM_PORT_JABBER')) ) 
     20                                throw new Exception(__CLASS__ . '[ ERROR #3 ] : Webjabber server is not cofigured'); 
     21 
     22                        $this->_server = constant('IM_NAME_JABBER'); 
     23                        $this->_resource = constant('IM_RESOURCE_JABBER'); 
     24 
     25                        $this->_port = constant('IM_PORT_JABBER'); 
    4126 
    4227                        session_start(); 
     
    4833 
    4934                        $this->connected = false; 
    50                         if ( $this->connect($access_string, $this->_pass, $pConnectionType, constant('WEBJABBER_URL')) ) 
     35                        if ( $this->connect($access_string, $this->_pass, $pConnectionType, constant('IM_SERVER_WEBJABBER')) ) 
    5136                                $this->connected = true; 
    5237                } 
     
    121106        } 
    122107 
     108        public final function Composing($pJid) 
     109        { 
     110                $pJid = $pJid['jid']; 
     111                $id = 'chat' . "_" . time(); 
     112                $xml = "<message to='{$pJid}' type='chat' id='{$id}'><composing/></message>"; 
     113                $this->writeSocket($xml); 
     114        } 
     115 
     116        public final function Paused($pJid) 
     117        { 
     118                $pJid = $pJid['jid']; 
     119                $id = 'chat' . "_" . time(); 
     120                $xml = "<message to='{$pJid}' type='chat' id='{$id}'><paused/></message>"; 
     121                $this->writeSocket($xml); 
     122        } 
     123 
    123124        public final function SendMessage($pSendMessage) 
    124125        { 
     
    186187                        unset($id); 
    187188 
    188                         echo $xml; 
     189                        //echo $xml; 
    189190                        $this->writeSocket($xml); 
    190191                        $this->close(); 
  • trunk/instant_messenger/inc/class.ldap_im.inc.php

    r305 r318  
    1111        function __construct() 
    1212        { 
    13                 session_start(); 
    14                 $this->ldap_host                = $_SESSION['phpgw_info']['instant_messenger']['server_ldap_jabber']; 
    15                 $this->ldap_context     = $_SESSION['phpgw_info']['instant_messenger']['context_ldap_jabber']; 
    16                 $this->user                     = $_SESSION['phpgw_info']['instant_messenger']['user_ldap_jabber']; 
    17                 $this->password                 = $_SESSION['phpgw_info']['instant_messenger']['password_ldap_jabber']; 
    18                 $this->jid                              = $_SESSION['phpgw_info']['instant_messenger']['user']; 
    19                 $this->connect_ldap(false); 
    20                 session_write_close(); 
     13                try 
     14                { 
     15                        if ( !file_exists(dirname(__FILE__) . '/../instant_messenger.define.php') ) 
     16                                throw new Exception(__CLASS__ . '[ ERROR #1 ] : Not found configuration file'); 
     17 
     18                        require_once dirname(__FILE__) . '/../instant_messenger.define.php'; 
     19 
     20                        if ( !(defined('IM_SERVER_LDAP_JABBER') && defined('IM_CONTEXT_LDAP_JABBER')) ) 
     21                                throw new Exception(__CLASS__ . '[ ERROR #2 ] : Ldap server is not cofigured'); 
     22 
     23                        if ( !defined('IM_USER_LDAP_JABBER') ) 
     24                                throw new Exception(__CLASS__ . '[ ERROR #3 ] : Ldap server is not cofigured'); 
     25 
     26                        $this->ldap_host                = constant('IM_SERVER_LDAP_JABBER');  
     27                        $this->ldap_context     = constant('IM_CONTEXT_LDAP_JABBER'); 
     28                        $this->user                     = constant('IM_USER_LDAP_JABBER'); 
     29 
     30                        session_start(); 
     31                        $this->password                 = $_SESSION['phpgw_info']['instant_messenger']['password_ldap_jabber']; 
     32                        $this->jid                              = $_SESSION['phpgw_info']['instant_messenger']['user']; 
     33                        session_write_close(); 
     34 
     35                        $this->connect_ldap(false); 
     36 
     37                } 
     38                catch(Exception $e) 
     39                { 
     40                        echo $e->getMessage(); 
     41                }        
    2142        } 
    2243         
  • trunk/instant_messenger/inc/controller.xml

    r305 r318  
    3232                        <item ref="functions" js="functions" /> 
    3333                        <item ref="images" js="images" /> 
    34                         <item ref="cookies_im" js="cookies_im" /> 
     34                        <item ref="cookies" js="cookies" /> 
    3535                        <item ref="load" js="load" /> 
     36                        <item ref="preferences" js="preferences" /> 
     37                        <item ref="setup" js="setup" path="/var/www/expresso/instant_messenger/templates/default/"/> 
    3638                </js> 
    3739                <php path="/var/www/expresso/instant_messenger/inc" suffix=".class.php"> 
     
    5355                        <item ref="Ujabber" alias="updateContact" class="Ujabber" method="updateContact" prefix="class." suffix=".inc.php" /> 
    5456                        <item ref="Ujabber" alias="setStatus" class="Ujabber" method="setStatus" prefix="class." suffix=".inc.php" /> 
     57                        <item ref="FileDefine" alias="getParams" class="FileDefine" method="getParams" prefix="class." suffix=".inc.php"/> 
     58                        <item ref="composing" class="Ujabber" method="composing" prefix="class." suffix=".inc.php" /> 
     59                        <item ref="paused" class="Ujabber" method="paused" prefix="class." suffix=".inc.php" /> 
    5560                </php> 
    5661                <xml></xml> 
  • trunk/instant_messenger/inc/im_sessions.inc.php

    r305 r318  
    44                $_SESSION['phpgw_info']['instant_messenger']['user_id']                  = $GLOBALS['phpgw_info']['user']['account_id'];                 
    55                $_SESSION['phpgw_info']['instant_messenger']['passwd']           = $GLOBALS['phpgw_info']['user']['passwd']; 
    6                 #$_SESSION['phpgw_info']['instant_messenger']['name_jabber']      = $GLOBALS['phpgw_info']['server']['name_jabber']; 
    7                 #$_SESSION['phpgw_info']['instant_messenger']['port_jabber']      = $GLOBALS['phpgw_info']['server']['port_jabber']; 
    8                 #$_SESSION['phpgw_info']['instant_messenger']['resource_jabber']  = $GLOBALS['phpgw_info']['server']['resource_jabber']; 
    9                 #$_SESSION['phpgw_info']['instant_messenger']['tls_jabber']      = $GLOBALS['phpgw_info']['server']['tls_jabber']; 
    106                 
    117                $_SESSION['phpgw_info']['instant_messenger']['server_ldap_jabber']   = $GLOBALS['phpgw_info']['server']['server_ldap_jabber']; 
  • trunk/instant_messenger/instant_messenger.define.php

    r305 r318  
    1 <?php 
    2 define('JABBER_URL', 'im.pr.gov.br'); 
    3 define('JABBER_RESOURCE', 'Homologa'); 
    4  
    5 define('WEBJABBER_URL', 'im.pr.gov.br'); 
    6 define('WEBJABBER_PORT', '8883'); 
     1<?php  
     2define('IM_NAME_JABBER', 'im.pr.gov.br'); 
     3define('IM_RESOURCE_JABBER', 'IM_ALE'); 
     4define('IM_PORT_JABBER', '8884'); 
     5define('IM_SERVER_WEBJABBER', 'im.pr.gov.br'); 
     6define('IM_SERVER_LDAP_JABBER', 'ldap://ldap.eparana.parana'); 
     7define('IM_CONTEXT_LDAP_JABBER', 'dc=pr,dc=gov,dc=br'); 
     8define('IM_USER_LDAP_JABBER', 'uid=expresso,dc=sistemas,dc=pr,dc=gov,dc=br'); 
    79?> 
  • trunk/instant_messenger/js/client.js

    r311 r318  
    11(function() 
    22{ 
    3         function _config(pObj, pEvent, pHandler) 
     3 
     4        var _cookies = new IMCookies; 
     5        var _running = _cookies.get('IM_running'); 
     6        if ( !_running ) 
    47        { 
    5                 if ( typeof pObj == 'object' ) 
    6                 { 
    7                         if ( pEvent.substring(0, 2) == 'on' ) 
    8                                 pEvent = pEvent.substring(2, pEvent.length); 
    9  
    10                         if ( pObj.addEventListener ) 
    11                                 pObj.addEventListener(pEvent, pHandler, false); 
    12                         else if ( pObj.attachEvent ) 
    13                                 pObj.attachEvent('on' + pEvent, pHandler); 
    14                 } 
    15         } 
    16  
    17         if ( !(top.document.getElementById('instant_messenger_content')) ) 
    18         { 
    19                 var _im_content = top.document.createElement('div'); 
    20                 _im_content.setAttribute('id', 'instant_messenger_content'); 
    21                 _im_content = top.document.body.appendChild(_im_content); 
    22         } 
    23  
    24         var buffer = ''; 
    25         var _disconnected = false; 
    26  
    27         var _conn = new IMConnector(path_im); 
    28         var _xtools = new XTools(path_im); 
    29         var _window = new Windows(_xtools, _im_content); 
    30         var _ldap = new InstantMessengerLDAP(_conn, _xtools, _window); 
    31         var _showhidden = new ShowHidden(1500); 
    32         var _jabber = new Jabber(_conn, _xtools, _window, _ldap, _showhidden); 
    33  
    34         // XSL preload 
    35         var _xsl_preload = ['window.xsl','layer.xsl','contacts.xsl', 'chat.xsl']; 
    36         var _xsl_preload_legth = _xsl_preload.length; 
    37         for ( var i = 0; i < _xsl_preload_legth; i++ ) 
    38                 _xtools.load(_xsl_preload[i]); 
    39  
    40         var local; 
    41         if ( (local = top.document.getElementById('user_info')) ) 
    42         { 
    43                 local.firstChild.style.marginLeft = '30px'; 
    44  
    45                 var _status = top.document.createElement('div'); 
    46                         _status.setAttribute('id', 'im_status'); 
    47                         _status.style.height = '15px'; 
    48                         _status.style.margin = '0 0 0 10px'; 
    49                         _status.style.padding = '0px'; 
    50                         _status.style.width = '15px'; 
    51                         _status.style.background = 'no-repeat'; 
    52                         _status.style.backgroundImage = 'url(' + im_unavailable.src + ')'; 
    53                         _status.style.float = 'left'; 
    54                         _status.style.position = 'absolute'; 
    55  
    56                 local.insertBefore(_status, local.firstChild); 
    57  
    58                 _config(_status, 'onclick', _contacts); 
    59  
    60                 var _menu; 
    61                         _menu = top.document.createElement('span'); 
    62                         _menu.setAttribute('id','fast_menu_im'); 
    63                         _menu.style.backgroundColor = 'b4cfe5'; 
    64                         _menu.style.display = 'none'; 
    65                         _menu.style.margin = '15px 0 0 -15px'; 
    66                         _menu.style.position = 'absolute'; 
    67                         _menu.style.zIndex = '99999'; 
    68                 local.insertBefore(_menu, local.firstChild); 
    69  
    70                 var _menu_img = top.document.createElement('div'); 
    71                         _menu_img.style.background = 'no-repeat'; 
    72                         _menu_img.style.backgroundImage = 'url(' + im_fast_menu.src + ')'; 
    73                         _menu_img.style.height = '10px'; 
    74                         _menu_img.style.margin = '0px'; 
    75                         _menu_img.style.padding = '0px'; 
    76                         _menu_img.style.position = 'absolute'; 
    77                         _menu_img.style.width = '10px'; 
    78                         _menu_img.style.float = 'left'; 
    79                 local.insertBefore(_menu_img, local.firstChild); 
    80  
    81                 _config( 
    82                         _menu_img, 
    83                         'onclick', 
     8                _cookies.set('IM_running', 'true'); 
     9 
     10                function _config(pObj, pEvent, pHandler) 
     11                { 
     12                        if ( typeof pObj == 'object' ) 
     13                        { 
     14                                if ( pEvent.substring(0, 2) == 'on' ) 
     15                                        pEvent = pEvent.substring(2, pEvent.length); 
     16 
     17                                if ( pObj.addEventListener ) 
     18                                        pObj.addEventListener(pEvent, pHandler, false); 
     19                                else if ( pObj.attachEvent ) 
     20                                        pObj.attachEvent('on' + pEvent, pHandler); 
     21                        } 
     22                } 
     23 
     24                _config(window, 'onbeforeunload', 
    8425                        function() 
    8526                        { 
    86                                 var _options = [ 
    87                                         'available', 
    88                                         'away', 
    89                                         'dnd', 
    90                                         'unavailable' 
    91                                 ]; 
    92  
    93                                 var _style_text = 'cursor: pointer; padding:2px 4px 2px 20px; background: no-repeat '; 
    94  
    95                                 var _xml = _xtools.xml('menu'); 
    96                                 var _option; 
    97                                 var _item; 
    98                                 var _action; 
    99                                 var _style; 
    100  
    101                                 for ( var i in _options ) 
     27                                var _running = _cookies.get('IM_running'); 
     28                                _cookies.clear('IM_running'); 
     29                        } 
     30                ); 
     31 
     32                if ( !(top.document.getElementById('instant_messenger_content')) ) 
     33                { 
     34                        var _im_content = top.document.createElement('div'); 
     35                        _im_content.setAttribute('id', 'instant_messenger_content'); 
     36                        _im_content = top.document.body.appendChild(_im_content); 
     37                } 
     38 
     39                var buffer = ''; 
     40                var _disconnected = false; 
     41 
     42                var _conn = new IMConnector(path_im); 
     43                var _xtools = new XTools(path_im); 
     44                var _window = new Windows(_xtools, _im_content); 
     45                var _ldap = new InstantMessengerLDAP(_conn, _xtools, _window); 
     46                var _showhidden = new ShowHidden(1500); 
     47                var _jabber = new Jabber(_conn, _xtools, _window, _ldap, _showhidden, _cookies); 
     48 
     49                // XSL preload 
     50                var _xsl_preload = [ 
     51                        'window.xsl', 
     52                        'layer.xsl', 
     53                        'contacts.xsl', 
     54                        'chat.xsl', 
     55                        'options.xsl' 
     56                ]; 
     57                var _xsl_preload_legth = _xsl_preload.length; 
     58                for ( var i = 0; i < _xsl_preload_legth; i++ ) 
     59                        _xtools.load(_xsl_preload[i]); 
     60 
     61                function _stream(data) 
     62                { 
     63                        data = data.replace(/^ | $/, ''); 
     64 
     65                        if ( !(data.length) ) 
     66                                return false; 
     67 
     68                        if ( data.indexOf('disconnected') != -1 || data.indexOf('</stream:stream>') != -1 ) 
     69                                _disconnect(); 
     70                        else 
     71                        { 
     72                                if ( data.lastIndexOf('>') != data.length - 1) 
     73                                        buffer += data + ' '; 
     74                                else 
    10275                                { 
    103                                         _option = _xml.createElement('option'); 
    104  
    105                                         _item = _xml.createElement('item'); 
    106                                         _item.appendChild(_xml.createTextNode(imGetLang(_options[i]))); 
    107  
    108                                         _style = _xml.createElement('style'); 
    109                                         _style.appendChild(_xml.createTextNode(_style_text + 'url(' + eval('im_' + _options[i] + '.src') + ')')); 
    110  
    111                                         _option.appendChild(_item); 
    112                                         _option.appendChild(_style); 
    113  
    114                                         _xml.documentElement.appendChild(_option); 
     76                                        if ( buffer.length ) 
     77                                        { 
     78                                                data = buffer + data; 
     79                                                buffer = ''; 
     80                                        } 
     81 
     82                                        // with xmlns, occurs problems during parse between 
     83                                        // xml and xsl, and for that reason it was removed 
     84                                        data = data.replace(/ xmlns='.*?'/g, ''); 
     85                                        data = '<handler>' + data + '</handler>'; 
     86 
     87                                        var _xml = _xtools.convert(data); 
     88 
     89                                        if ( _xml ) 
     90                                        { 
     91                                                var _node = _xml.documentElement.firstChild; 
     92 
     93                                                while ( _node ) 
     94                                                { 
     95                                                        if ( _node.nodeType == 1 ) 
     96                                                                _jabber.action(_node); 
     97                                                        //else 
     98                                                        //      alert('name : ' + _node.nodeName + 
     99                                                        //                      "\n\nhas children:" + _node.hasChildNodes() + 
     100                                                        //                      "\nvalue\n\n" + _node.nodeValue); 
     101 
     102                                                        _node = _node.nextSibling; 
     103                                                } 
     104                                        } 
    115105                                } 
    116  
    117                                 _menu.innerHTML = _xtools.parse(_xml, 'options.xsl'); 
    118                                 _showhidden.action('onmouseover', 'onmouseout', _menu); 
    119  
    120                                 _item = _menu.firstChild; 
    121  
    122                                 for ( var i in _options ) 
    123                                 { 
    124                                         _item.childNodes[i].setAttribute('presence', _options[i]); 
    125                                         _config( 
    126                                                 _item.childNodes[i], 
    127                                                 'onclick', 
    128                                                 function(e) 
    129                                                 { 
    130                                                         var el = ( e.target ) ? e.target : e.srcElement; 
    131  
    132                                                         _status.style.backgroundImage = el.style.backgroundImage; 
    133  
    134                                                         var _presence = el.getAttribute('presence'); 
    135                                                                 _jabber.setPresence(_presence); 
    136  
    137                                                         var _win_contacts = _window.get('contact_list'); 
    138                                                         if ( _win_contacts ) 
    139                                                                 _win_contacts.icon(eval('im_' + _presence + '.src')); 
    140                                                 } 
    141                                         ); 
    142                                 } 
    143                         } 
    144                 ); 
    145         } 
    146  
    147         function _stream(data) 
    148         { 
    149                 data = data.replace(/^ | $/, ''); 
    150  
    151                 if ( !(data.length) ) 
    152                         return false; 
    153  
    154                 if ( data.indexOf('disconnected') != -1 || data.indexOf('</stream:stream>') != -1 ) 
     106                        } 
     107                } 
     108 
     109                var _count_reconnect = 0; 
     110                function _request() 
     111                { 
     112                        if ( !_disconnected ) 
     113                                return _conn.go( 
     114                                        '$this.Ujabber.listen', 
     115                                        {'stream':_stream, 'request':_wait}, 
     116                                        'classCostructor=read' 
     117                                ); 
     118                        else 
     119                                setTimeout(_reconnect, (++_count_reconnect * 2000)); 
     120                } 
     121 
     122                function _wait() 
     123                { 
     124                        setTimeout(_request, 3000); 
     125                } 
     126 
     127                function _reconnect() 
     128                { 
     129                        _disconnected = false; 
     130                        _request(); 
     131                } 
     132 
     133                function _disconnect() 
    155134                { 
    156135                        _disconnected = true; 
    157                         //alert('disconnected'); 
    158                 } 
    159                 else 
    160                 { 
    161                         if ( data.lastIndexOf('>') != data.length - 1) 
    162                                 buffer += data + ' '; 
    163                         else 
    164                         { 
    165                                 if ( buffer.length ) 
    166                                 { 
    167                                         data = buffer + data; 
    168                                         buffer = ''; 
    169                                 } 
    170  
    171                                 // com xmlns ocorre problemas durante o parse entre 
    172                                 // xml e xsl e por esse motivo está sendo retirado 
    173                                 data = data.replace(/ xmlns='.*?'/g, ''); 
    174                                 data = '<handler>' + data + '</handler>'; 
    175  
    176                                 var _xml = _xtools.convert(data); 
    177  
    178                                 if ( _xml ) 
    179                                 { 
    180                                         var _node = _xml.documentElement.firstChild; 
    181  
    182                                         while ( _node ) 
    183                                         { 
    184                                                 if ( _node.nodeType == 1 ) 
    185                                                         _jabber.action(_node); 
    186                                                 //else 
    187                                                 //      alert('name : ' + _node.nodeName + "\n\nhas children:" + _node.hasChildNodes() + "\nvalue\n\n" + _node.nodeValue); 
    188  
    189                                                 _node = _node.nextSibling; 
    190                                         } 
    191                                 } 
    192                         } 
    193                 } 
    194         } 
    195  
    196         var _count_reconnect = 0; 
    197         function _request() 
    198         { 
    199                 if ( !_disconnected ) 
    200                         return _conn.go( 
    201                                 '$this.Ujabber.listen', 
    202                                 {'stream':_stream, 'request':_wait}, 
    203                                 'classCostructor=read' 
    204                         ); 
    205                 else 
    206                         setTimeout(_reconnect, (++_count_reconnect * 2000)); 
    207         } 
    208  
    209         function _wait() 
    210         { 
    211                 setTimeout(_request, 3000); 
    212         } 
    213  
    214         function _reconnect() 
    215         { 
    216                 _disconnected = false; 
    217                 _request(); 
    218         } 
    219  
    220         function _disconnect() 
    221         { 
    222                 _disconnected = true; 
    223         } 
    224  
    225         function _contacts() 
    226         { 
    227                 var _win = _window.get('contact_list'); 
    228                 if ( _win ) 
    229                         if ( _win.wm.style.display != 'none' ) 
    230                                 _win.wm.style.display = 'none'; 
    231                         else 
    232                                 _win.wm.style.display = 'block'; 
    233                 else 
     136                        _conn.abort(); 
     137                        _loading(); 
     138                        var _status = top.document.getElementById('im_status'); 
     139                        if ( _status ) 
     140                                _status.style.backgroundImage = 'url(' + im_unavailable.src + ')'; 
     141 
     142                        var _win_contacts = _window.get('contact_list'); 
     143                        if ( _win_contacts ) 
     144                                _win_contacts.icon(im_unavailable.src); 
     145                } 
     146 
     147                function _contacts() 
     148                { 
    234149                        if ( !_disconnected ) 
    235150                                _conn.go('$this.Ujabber.getContacts'); 
     151                } 
     152 
     153                function _loading() 
     154                { 
     155                        var _win_contact = _window.get('contact_list'); 
     156                        if ( !_win_contact ) 
     157                        { 
     158                                _win_contact = _window.load('contact_list'); 
     159                                _win_contact.hidden(); 
     160                                _win_contact.title('.::Expresso Messenger::.'); 
     161                                _win_contact.size(170, 350); 
     162                                _win_contact.position(30, 30, true); 
     163                                _win_contact.icon(im_unavailable.src); 
     164                                _win_contact.bc.style.display = 'none'; 
     165                        } 
     166 
     167                        _win_contact.loading(); 
     168                } 
     169 
     170                function _showContacts() 
     171                { 
     172                        var _win = _window.get('contact_list'); 
     173                        if ( _win ) 
     174                                if ( _win.wm.style.display == 'none' ) 
     175                                        _win.wm.style.display = 'block'; 
     176                                else 
     177                                        _win.wm.style.display = 'none'; 
     178                } 
     179 
     180                _loading(); 
     181 
     182                var local; 
     183                if ( (local = top.document.getElementById('user_info')) ) 
     184                { 
     185                        local.firstChild.style.marginLeft = '30px'; 
     186 
     187                        var _status = top.document.createElement('div'); 
     188                                _status.setAttribute('id', 'im_status'); 
     189                                _status.style.height = '15px'; 
     190                                _status.style.margin = '0 0 0 10px'; 
     191                                _status.style.padding = '0px'; 
     192                                _status.style.width = '15px'; 
     193                                _status.style.background = 'no-repeat'; 
     194                                _status.style.backgroundImage = 'url(' + im_unavailable.src + ')'; 
     195                                _status.style.float = 'left'; 
     196                                _status.style.position = 'absolute'; 
     197 
     198                        local.insertBefore(_status, local.firstChild); 
     199 
     200                        _config(_status, 'onclick', _showContacts); 
     201 
     202                        var _menu; 
     203                                _menu = top.document.createElement('span'); 
     204                                _menu.setAttribute('id','fast_menu_im'); 
     205                                _menu.style.backgroundColor = 'b4cfe5'; 
     206                                _menu.style.display = 'none'; 
     207                                _menu.style.margin = '15px 0 0 -15px'; 
     208                                _menu.style.position = 'absolute'; 
     209                                _menu.style.zIndex = '99999'; 
     210                        local.insertBefore(_menu, local.firstChild); 
     211 
     212                        var _menu_img = top.document.createElement('div'); 
     213                                _menu_img.style.background = 'no-repeat'; 
     214                                _menu_img.style.backgroundImage = 'url(' + im_fast_menu.src + ')'; 
     215                                _menu_img.style.height = '10px'; 
     216                                _menu_img.style.margin = '0px'; 
     217                                _menu_img.style.padding = '0px'; 
     218                                _menu_img.style.position = 'absolute'; 
     219                                _menu_img.style.width = '10px'; 
     220                                _menu_img.style.float = 'left'; 
     221                        local.insertBefore(_menu_img, local.firstChild); 
     222 
     223                        _config( 
     224                                _menu_img, 
     225                                'onclick', 
     226                                function() 
     227                                { 
     228                                        var _options = [ 
     229                                                'available', 
     230                                                'away', 
     231                                                'dnd', 
     232                                                'unavailable' 
     233                                        ]; 
     234 
     235                                        var _style_text = 'cursor: pointer; padding:2px 4px 2px 20px; background: no-repeat '; 
     236 
     237                                        var _xml = _xtools.xml('menu'); 
     238                                        var _option; 
     239                                        var _item; 
     240                                        var _action; 
     241                                        var _style; 
     242 
     243                                        for ( var i in _options ) 
     244                                        { 
     245                                                _option = _xml.createElement('option'); 
     246 
     247                                                _item = _xml.createElement('item'); 
     248                                                _item.appendChild(_xml.createTextNode(imGetLang(_options[i]))); 
     249 
     250                                                _style = _xml.createElement('style'); 
     251                                                _style.appendChild(_xml.createTextNode(_style_text + 'url(' + eval('im_' + _options[i] + '.src') + ')')); 
     252 
     253                                                _option.appendChild(_item); 
     254                                                _option.appendChild(_style); 
     255 
     256                                                _xml.documentElement.appendChild(_option); 
     257                                        } 
     258 
     259                                        _menu.innerHTML = _xtools.parse(_xml, 'options.xsl'); 
     260                                        _showhidden.action('onmouseover', 'onmouseout', _menu); 
     261 
     262                                        _item = _menu.firstChild; 
     263 
     264                                        for ( var i in _options ) 
     265                                        { 
     266                                                _item.childNodes[i].setAttribute('presence', _options[i]); 
     267                                                _config( 
     268                                                        _item.childNodes[i], 
     269                                                        'onclick', 
     270                                                        function(e) 
     271                                                        { 
     272                                                                var el = ( e.target ) ? e.target : e.srcElement; 
     273                                                                var _presence = el.getAttribute('presence'); 
     274                                                                _jabber.setPresence(_presence); 
     275                                                        } 
     276                                                ); 
     277                                        } 
     278                                } 
     279                        ); 
     280                } 
     281 
     282                function Client() 
     283                { 
     284                        _request(); 
     285                        setTimeout(_contacts, 3000); 
     286                } 
     287 
     288                window.InstantMessengerClient = Client; 
    236289        } 
    237  
    238         function Client() 
    239         { 
    240                 _request(); 
    241                 setTimeout('InstantMessengerContacts()', 3000); 
    242         } 
    243  
    244         window.InstantMessengerClient = Client; 
    245         window.InstantMessengerReconnect = _reconnect; 
    246         window.InstantMessengerDisconnect = _disconnect; 
    247         window.InstantMessengerContacts = _contacts; 
    248290} 
    249291)(); 
  • trunk/instant_messenger/js/connector.js

    r311 r318  
    33        var _THREADS = []; 
    44        var _ie; 
     5 
     6        function _config(pObj, pEvent, pHandler) 
     7        { 
     8                if ( typeof pObj == 'object' ) 
     9                { 
     10                        if ( pEvent.substring(0, 2) == 'on' ) 
     11                                pEvent = pEvent.substring(2, pEvent.length); 
     12 
     13                        if ( pObj.addEventListener ) 
     14                                pObj.addEventListener(pEvent, pHandler, false); 
     15                        else if ( pObj.attachEvent ) 
     16                                pObj.attachEvent('on' + pEvent, pHandler); 
     17                } 
     18        } 
    519 
    620        // xhr = XMLHttpRequest 
     
    3650                var _ID = arguments[0]; 
    3751 
    38                 if ( _ie && _THREADS[_ID]._XHR.readyState != 4 ) 
    39                         return false; 
    40  
    41                 switch ( _THREADS[_ID]._XHR.readyState ) 
    42                 { 
    43                         case 3 : 
    44                                 if ( _THREADS[_ID]._HANDLER.stream ) 
    45                                 { 
    46                                         var _data = _THREADS[_ID]._XHR.responseText.substr(_THREADS[_ID]._index).replace(/^ +| +$/g, ''); 
    47                                         //alert(_data); 
    48                                         _THREADS[_ID]._rtlen = _THREADS[_ID]._XHR.responseText.length; 
    49  
    50                                         if ( _THREADS[_ID]._index < _THREADS[_ID]._rtlen && _data.length ) 
    51                                                 try 
    52                                                 { 
    53                                                         _THREADS[_ID]._HANDLER.stream(_data); 
    54                                                 } 
    55                                                 catch(_e) 
    56                                                 { 
    57                                                         alert("#stream\n\n" + _e + "\n\n" + _e.description); 
    58                                                 } 
    59  
    60                                         _THREADS[_ID]._index = _THREADS[_ID]._rtlen; 
    61                                 } 
    62                         break; 
    63                         case 4 : 
    64                                 switch ( _THREADS[_ID]._XHR.status ) 
    65                                 { 
    66                                         case 200: 
    67                                                 var _data = ( _THREADS[_ID]._MODE == 'XML' ) ? 
    68                                                         _THREADS[_ID]._XHR.responseXML : 
    69                                                         _THREADS[_ID]._XHR.responseText; 
    70  
    71                                                 if ( _ie && _THREADS[_ID]._HANDLER.stream ) 
    72                                                         _THREADS[_ID]._HANDLER.stream(_data); 
    73  
    74                                                 var _request = ( _THREADS[_ID]._HANDLER.request ) ? 
    75                                                         _THREADS[_ID]._HANDLER.request : false; 
    76  
    77                                                 delete _THREADS[_ID]; 
    78  
    79                                                 if ( _request ) 
     52                if  ( _THREADS[_ID] ) 
     53                { 
     54                        if ( _ie && _THREADS[_ID]._XHR.readyState != 4 ) 
     55                                return false; 
     56 
     57                        switch ( _THREADS[_ID]._XHR.readyState ) 
     58                        { 
     59                                case 3 : 
     60                                        if ( _THREADS[_ID]._HANDLER.stream ) 
     61                                        { 
     62                                                var _data = _THREADS[_ID]._XHR.responseText.substr(_THREADS[_ID]._index).replace(/^ +| +$/g, ''); 
     63                                                //alert(_data); 
     64                                                _THREADS[_ID]._rtlen = _THREADS[_ID]._XHR.responseText.length; 
     65 
     66                                                if ( _THREADS[_ID]._index < _THREADS[_ID]._rtlen && _data.length ) 
    8067                                                        try 
    8168                                                        { 
    82                                                                 _request(_data); 
     69                                                                _THREADS[_ID]._HANDLER.stream(_data); 
    8370                                                        } 
    8471                                                        catch(_e) 
    8572                                                        { 
    86                                                                 alert("#request\n\n" + _e + "\n\n" + _e.description); 
     73                                                                alert("#stream\n\n" + _e + "\n\n" + _e.description); 
    8774                                                        } 
    8875 
    89                                         break; // [case : status 200] 
    90                                         case 404: 
    91                                                 delete _THREADS[_ID]; 
    92                                                 alert('Page Not Found!'); 
    93                                         break; // [case : status 404] 
    94                                         default: 
    95                                                 delete _THREADS[_ID]; 
    96                                 } 
    97                         break; 
    98                         default : 
     76                                                if ( _THREADS[_ID] ) 
     77                                                        _THREADS[_ID]._index = _THREADS[_ID]._rtlen; 
     78                                        } 
     79                                break; 
     80                                case 4 : 
     81                                        try 
     82                                        { 
     83                                                switch ( _THREADS[_ID]._XHR.status ) 
     84                                                { 
     85                                                        case 200: 
     86                                                                var _data = ( _THREADS[_ID]._MODE == 'XML' ) ? 
     87                                                                        _THREADS[_ID]._XHR.responseXML : 
     88                                                                        _THREADS[_ID]._XHR.responseText; 
     89 
     90                                                                if ( _ie && _THREADS[_ID]._HANDLER.stream ) 
     91                                                                        _THREADS[_ID]._HANDLER.stream(_data); 
     92 
     93                                                                var _request = ( _THREADS[_ID]._HANDLER.request ) ? 
     94                                                                        _THREADS[_ID]._HANDLER.request : false; 
     95 
     96                                                                delete _THREADS[_ID]; 
     97 
     98                                                                if ( _request ) 
     99                                                                        try 
     100                                                                        { 
     101                                                                                _request(_data); 
     102                                                                        } 
     103                                                                        catch(_e) 
     104                                                                        { 
     105                                                                                alert("#request\n\n" + _e + "\n\n" + _e.description); 
     106                                                                        } 
     107 
     108                                                        break; // [case : status 200] 
     109                                                        case 404: 
     110                                                                delete _THREADS[_ID]; 
     111                                                                alert('Page Not Found!'); 
     112                                                        break; // [case : status 404] 
     113                                                        default: 
     114                                                                delete _THREADS[_ID]; 
     115                                                } 
     116                                        } 
     117                                        catch(e) 
     118                                        { 
     119                                        } 
     120                                break; 
     121                                default : 
     122                        } 
    99123                } 
    100124        } 
     
    236260        } 
    237261 
     262        function _abort() 
     263        { 
     264                for ( var _ID in _THREADS ) 
     265                { 
     266                        // @TODO 
     267                        // try/catch for unknown error of IE. 
     268                        // Check, store and retrieve the try/catch. 
     269                        try 
     270                        { 
     271                                if ( _THREADS[_ID] && _THREADS[_ID]._XHR && _THREADS[_ID]._XHR.abort ) 
     272                                        _THREADS[_ID]._XHR.abort(); 
     273 
     274                                delete _THREADS[_ID]; 
     275                        } 
     276                        catch(e){} 
     277                } 
     278        } 
     279 
    238280        function Connector() 
    239281        { 
     
    246288 
    247289        Connector.prototype.go = go; 
     290        Connector.prototype.abort = _abort; 
    248291        window.IMConnector = Connector; 
    249292 
    250         var _unload_event = window.onbeforeunload; 
    251         window.onbeforeunload = function() 
    252         { 
    253                 for ( var _ID in _THREADS ) 
    254                 { 
    255                         //if ( _THREADS[_ID]._XHR.abort ) 
    256                         try 
    257                         { 
    258                                 if ( _THREADS[_ID]._XHR && _THREADS[_ID]._XHR.abort ) 
    259                                         _THREADS[_ID]._XHR.abort(); 
    260                                 delete _THREADS[_ID]; 
    261                         } 
    262                         catch(e) 
    263                         { 
    264                         } 
    265                 } 
    266  
    267                 if ( typeof _unload_event == 'function' ) 
    268                         return _unload_event(); 
    269         }; 
     293        _config(window, 'onbeforeunload', _abort); 
    270294} 
    271295)(); 
  • trunk/instant_messenger/js/dragdrop.js

    r305 r318  
    129129                        e.preventDefault(); 
    130130                else 
    131                         el.onselectstart = new Function("return false;"); 
     131                        e.onselectstart = new Function("return false;"); 
    132132 
    133133                var el = ( e.target ) ? e.target : e.srcElement; 
  • trunk/instant_messenger/js/images.js

    r311 r318  
    3232        var im_group_close = new Image(); 
    3333        im_group_close.src = path_im + 'templates/default/images/group_close.gif'; 
     34 
     35        var im_console_prefs = new Image(); 
     36        im_console_prefs.src = path_im + 'templates/default/images/console_prefs2.png'; 
     37 
     38        var im_composing = new Image(); 
     39        im_composing.src = path_im + 'templates/default/images/typing.gif'; 
    3440 
    3541// Smiles 
  • trunk/instant_messenger/js/jabber.js

    r311 r318  
    66        var _ldap; 
    77        var _menu; 
     8        var _cookies; 
    89 
    910        var _vcards = []; 
    1011        var _info = []; 
    11  
    12         var _win_position = 30; 
     12        var _chats = []; 
     13 
     14        var _win_position = 0; 
    1315 
    1416        function _next_position() 
    1517        { 
     18                if ( _win_position > 200 ) 
     19                        _win_position = 0; 
    1620                return (_win_position += 30); 
    1721        } 
     
    1923        function _chat(_pJid) 
    2024        { 
     25                if ( !_chats[_pJid] ) 
     26                        _chats[_pJid] = []; 
     27 
    2128                var _win_pos = _next_position(); 
    2229                var _win_chat = _window.load('chat' + _pJid); 
     
    7683                ); 
    7784 
     85                var _composing_paused = null; 
    7886                function _execKeyAction(e) 
    7987                { 
     88                        if ( e.type.indexOf('keydown') != -1 ) 
     89                        { 
     90                                if ( (e.keyCode > 48 && e.keyCode < 112) || e.keyCode > 186 ) 
     91                                { 
     92                                        if ( _chats[_pJid]['composing_paused'] ) 
     93                                        { 
     94                                                clearTimeout(_chats[_pJid]['composing_paused']); 
     95                                                _chats[_pJid]['composing_paused'] = null; 
     96                                        } 
     97                                        else 
     98                                                _conn.go('t.composing','jid='+_pJid); 
     99 
     100                                        _chats[_pJid]['composing_paused'] = setTimeout( 
     101                                        function() 
     102                                        { 
     103                                                if ( _chats[_pJid]['composing_paused'] ) 
     104                                                { 
     105                                                        clearTimeout(_chats[_pJid]['composing_paused']); 
     106                                                        _chats[_pJid]['composing_paused'] = null; 
     107                                                } 
     108                                                _conn.go('t.paused','jid='+_pJid); 
     109                                        }, 5000); 
     110                                } 
     111                        } 
    80112                        switch ( e.keyCode ) 
    81113                        { 
     
    84116                                        { 
    85117                                                if ( e.type.indexOf('keydown') != -1 ) 
     118                                                { 
     119                                                        if ( _chats[_pJid]['composing_paused'] ) 
     120                                                        { 
     121                                                                clearTimeout(_chats[_pJid]['composing_paused']); 
     122                                                                _chats[_pJid]['composing_paused'] = null; 
     123                                                        } 
     124 
    86125                                                        _sendMessage( 
    87126                                                                _pJid, 
     
    89128                                                                _win_chat.wc.firstChild 
    90129                                                        ); 
     130                                                } 
    91131                                                else 
    92132                                                        _iframe.body.innerHTML = ''; 
     
    97137                                case 27 : 
    98138                                        if ( e.type.indexOf('keyup') != -1 ) 
     139                                        { 
     140                                                if ( _chats[_pJid]['composing_paused'] ) 
     141                                                { 
     142                                                        clearTimeout(_chats[_pJid]['composing_paused']); 
     143                                                        _chats[_pJid]['composing_paused'] = null; 
     144                                                } 
    99145                                                _win_chat.button(_win_chat.bc); 
     146                                        } 
    100147                                break; 
    101148                        } 
    102149                } 
     150                _config(_contentWindow.document, 'onkeyup', _execKeyAction); 
    103151                _config(_contentWindow.document, 'onkeydown', _execKeyAction); 
    104                 _config(_contentWindow.document, 'onkeyup', _execKeyAction); 
    105152 
    106153                if ( !(_vcards[_pJid]) ) 
     
    128175        function _openChat(el) 
    129176        { 
    130                 var id = el.id; 
    131  
    132                 id = id.substr(id.indexOf('_') + 1); 
     177                var id = el.getAttribute('jid'); 
    133178 
    134179                if ( id.indexOf('/') > -1 ) 
     
    139184                { 
    140185                        _win = _chat(id); 
    141                         var _st = el.style.backgroundImage; 
    142                         _win.icon(_st.substr(4, (_st.length - 5))); 
     186                        _win.title(el.getAttribute('idname')); 
     187                        _win.icon(eval('im_' + el.getAttribute('status') + '.src')); 
    143188                } 
    144189                else 
     
    152197        function _readContacts(_pContacts) 
    153198        { 
    154                 var _win_contact = _window.load('contact_list'); 
     199                var _win_contact = _window.get('contact_list'); 
     200                if ( !_win_contact ) 
     201                { 
     202                        _win_contact = _window.load('contact_list'); 
     203                        _win_contact.hidden(); 
    155204                        _win_contact.title('.::Expresso Messenger::.'); 
    156205                        _win_contact.size(170, 350); 
    157206                        _win_contact.position(30, 30, true); 
     207                        _win_contact.icon(im_unavailable.src); 
    158208                        _win_contact.bc.style.display = 'none'; 
    159                         _win_contact.wm.style.display = 'none'; 
    160                         _win_contact.icon(im_available.src); 
     209                } 
    161210 
    162211                var _params = { 
     
    176225                if ( _contact_list ) 
    177226                { 
    178                         _setPresence('unavailable'); 
     227                        _conn.go('$this.Ujabber.setPresence', 'type=unavailable'); 
    179228                        _setPresence(); 
    180229                        _ldap.photo( 
     
    241290                                                        var el = ( e.target ) ? e.target : e.srcElement; 
    242291                                                        var jid = el.parentNode.parentNode.id.substr(4); 
     292                                                        var _contact = el.parentNode.parentNode.previousSibling; 
     293                                                        _contact.parentNode.removeChild(_contact.nextSibling); 
     294                                                        _contact.parentNode.removeChild(_contact); 
    243295                                                        _conn.go('$this.Ujabber.removeContact','jid='+jid); 
    244296                                                } 
     
    264316                        } 
    265317                        var _contact = _contact_list.firstChild; 
     318                        var _show_all = _cookies.get('IM_unavailable'); 
    266319                        while ( _contact ) 
    267320                        { 
    268                                 _config(_contact, 'onmouseover', _hover); 
    269                                 _config(_contact, 'onmouseout', _hover); 
    270                                 if ( _contact.getAttribute('jid') ) 
     321                                if ( _contact.nodeName.toLowerCase() == 'div' ) 
    271322                                { 
    272                                         //_config(_contact, 'onmousedown', _click); 
    273                                         _config(_contact, 'onmouseup', _click); 
    274                                 } 
    275                                 else 
    276                                 { 
    277                                         _config(_contact, 'onclick', 
    278                                         function(e) 
    279                                         { 
    280                                                 var el = ( e.target ) ? e.target : e.srcElement; 
    281  
    282                                                 if ( el.style.backgroundImage.indexOf('group_open') < 0 ) 
    283                                                         el.style.backgroundImage = 'url(' + im_group_open.src + ')'; 
    284                                                 else 
    285                                                         el.style.backgroundImage = 'url(' + im_group_close.src + ')'; 
    286  
    287                                                 el = el.nextSibling; 
    288                                                 while ( el.getAttribute('jid') ) 
     323                                        _config(_contact, 'onmouseover', _hover); 
     324                                        _config(_contact, 'onmouseout', _hover); 
     325                                        if ( _contact.getAttribute('jid') ) 
     326                                        { 
     327                                                if ( _show_all == 'hidden' ) 
     328                                                        _contact.style.display = 'none'; 
     329                                                //_config(_contact, 'onmousedown', _click); 
     330                                                _config(_contact, 'onmouseup', _click); 
     331                                        } 
     332                                        else 
     333                                        { 
     334                                                _config(_contact, 'onclick', 
     335                                                function(e) 
    289336                                                { 
    290                                                         el.style.display = ( el.style.display != 'none' ) ? 
    291                                                                 'none' : 'block'; 
     337                                                        var el = ( e.target ) ? e.target : e.srcElement; 
     338                                                        var _display = "none"; 
     339                                                        var _image = im_group_close.src; 
     340 
     341                                                        if ( el.style.backgroundImage.indexOf('group_open') < 0 ) 
     342                                                        { 
     343                                                                _display = "block"; 
     344                                                                _image = im_group_open.src; 
     345                                                        } 
     346 
     347                                                        el.style.backgroundImage = 'url(' + _image + ')'; 
     348 
    292349                                                        el = el.nextSibling; 
    293                                                         if ( el && el.nextSibling ) 
     350                                                        while ( el.getAttribute('jid') ) 
     351                                                        { 
     352                                                                if ( el.style.backgroundImage.indexOf('unavailable') < 0 ) 
     353                                                                        el.style.display = _display; 
    294354                                                                el = el.nextSibling; 
    295                                                 } 
    296                                         }); 
     355                                                                if ( el && el.nextSibling ) 
     356                                                                        el = el.nextSibling; 
     357                                                        } 
     358                                                }); 
     359                                        } 
    297360                                } 
    298361                                _contact = _contact.nextSibling; 
     
    306369                var _pPresence; 
    307370                if ( arguments.length == 0 ) 
    308                         _pPresence = 'available'; 
     371                { 
     372                        if ( !(_pPresence = _cookies.get('IM_presence')) ) 
     373                                _pPresence = 'available'; 
     374                } 
    309375                else 
    310376                        _pPresence = arguments[0]; 
     377 
     378                _cookies.set('IM_presence', _pPresence); 
     379 
    311380                switch ( _pPresence ) 
    312381                { 
     
    324393                if ( _presence ) 
    325394                { 
     395                        var _img_status = eval('im_' + _pPresence + '.src'); 
     396 
    326397                        var _status = top.document.getElementById('im_status'); 
    327398                        if ( _status ) 
    328                                 _status.style.backgroundImage = 'url(' + eval('im_' + _pPresence + '.src') + ')'; 
     399                                _status.style.backgroundImage = 'url(' + _img_status + ')'; 
     400 
     401                        var _win_contacts = _window.get('contact_list'); 
     402                        if ( _win_contacts ) 
     403                                _win_contacts.icon(_img_status); 
     404 
    329405                        _conn.go('$this.Ujabber.setPresence', _presence); 
    330406                } 
     
    333409        function _vcard(_pJid) 
    334410        { 
     411                var _win_vcard; 
     412                if ( !(_win_vcard = _window.get('vcard_' + _pJid)) ) 
     413                { 
     414                        var _win_pos = _next_position(); 
     415 
     416                        _win_vcard = _window.load('vcard_' + _pJid); 
     417                        _win_vcard.title('.:: ' + imGetLang('Information Contacts') + ' ::.'); 
     418                        _win_vcard.size(300); 
     419                        _win_vcard.position(_win_pos, _win_pos); 
     420 
     421                        _win_vcard.wc.style.padding = "3px"; 
     422                        _win_vcard.bx.style.display = "none"; 
     423                } 
     424                else 
     425                        _win_vcard.focus(); 
     426 
    335427                if ( _vcards[_pJid] ) 
    336428                { 
    337429                        if ( _info[_pJid] ) 
    338430                                delete _info[_pJid]; 
    339  
    340                         var _win_vcard; 
    341                         if ( !(_win_vcard = _window.get('vcard_' + _pJid)) ) 
    342                         { 
    343                                 var _win_pos = _next_position(); 
    344  
    345                                 _win_vcard = _window.load('vcard_' + _pJid); 
    346                                 _win_vcard.title('.:: Informações do Contato ::.'); 
    347                                 _win_vcard.size(300); 
    348                                 _win_vcard.position(_win_pos, _win_pos); 
    349  
    350                                 _win_vcard.wc.style.padding = "3px"; 
    351                                 _win_vcard.bx.style.display = "none"; 
    352431 
    353432                                var _params = { 
     
    367446                                        ) 
    368447                                ); 
    369                         } 
    370                         else 
    371                                 _win_vcard.focus(); 
    372448                } 
    373449                else 
     450                { 
     451                        _win_vcard.loading(); 
    374452                        _conn.go('$this.Ujabber.getVcard', 'jid='+_pJid); 
     453                } 
    375454        } 
    376455 
     
    416495        { 
    417496                if ( pIq.firstChild.getAttribute("seconds") != 0 ) 
    418                         _setPresence(); 
     497                        _conn.go('$this.Ujabber.getContacts'); 
    419498        } 
    420499 
     
    426505                        _from = _from.substr(0, _from.indexOf('/')); 
    427506 
     507                var _contact_list = top.document.getElementById('contact_' + _from); 
     508 
    428509                var _win = _window.get('chat' + _from); 
    429510 
     511                if ( _contact_list && _pMessage.getElementsByTagName('composing').length > 0 ) 
     512                { 
     513                        _contact_list.style.backgroundImage = 'url(' + im_composing.src + ')'; 
     514                        setTimeout(function(){_contact_list.style.backgroundImage = 'url(' + eval('im_' + _contact_list.getAttribute('status') + '.src') + ')';}, 10000); 
     515                } 
     516 
    430517                if ( _win && _pMessage.getElementsByTagName('composing').length > 0 ) 
     518                { 
    431519                        _win.wc.childNodes[1].lastChild.style.display = 'block'; 
     520                        setTimeout(function(){_win.wc.childNodes[1].lastChild.style.display = 'none';}, 10000); 
     521                } 
    432522 
    433523                if ( _pMessage.getElementsByTagName('body').length > 0 ) 
     
    439529                                if ( _st ) 
    440530                                { 
    441                                         _st = _st.style.backgroundImage; 
    442                                         _win.icon(_st.substr(4, (_st.length - 5))); 
     531                                        _st = eval('im_' + _st.getAttribute('status') + '.src'); 
     532                                        _win.icon(_st); 
    443533                                } 
    444534                        } 
    445  
    446                         var _history = _win.wc.firstChild; 
     535                        _win.show(); 
    447536 
    448537                        var _nickname; 
     
    458547                                _nickname = _from; 
    459548 
    460                         var _msg = _xtools.parse(_pMessage, 'message_new.xsl', {'nickname':_nickname}); 
    461  
     549                        var _msg = _xtools.parse(_pMessage, 'message_new.xsl', {'nickname':_nickname,'time':Date().substr(16,5)}); 
     550 
     551                        var _history = _win.wc.firstChild; 
    462552                        if ( _history.scrollHeight == (_history.scrollTop + _history.clientHeight) ) 
    463553                        { 
     
    470560 
    471561                        _win.wc.childNodes[1].lastChild.style.display = 'none'; 
    472                 } 
     562                        if ( _contact_list ) 
     563                                _contact_list.style.backgroundImage = 'url(' + eval('im_' + _contact_list.getAttribute('status') + '.src') + ')'; 
     564                } 
     565 
     566                if ( _contact_list && _pMessage.getElementsByTagName('paused').length > 0 ) 
     567                        _contact_list.style.backgroundImage = 'url(' + eval('im_' + _contact_list.getAttribute('status') + '.src') + ')'; 
    473568 
    474569                if ( _win && _pMessage.getElementsByTagName('paused').length > 0 ) 
     
    486581                var _mensagem_status_contact = top.document.getElementById('status_' + _from); 
    487582                var _win_chat = _window.get('chat' + _from); 
     583 
     584                _img_status_contact.setAttribute('status', _presence_type); 
    488585 
    489586                if ( _mensagem_status_contact ) 
     
    503600                                        if ( _win_chat ) 
    504601                                                _win_chat.icon(eval('im_' + _presence_type + '.src')); 
     602                                        if ( _presence_type == 'unavailable' ) 
     603                                        { 
     604                                                var _show_all = _cookies.get('IM_unavailable'); 
     605                                                if ( _show_all == 'hidden' ) 
     606                                                        _img_status_contact.style.display = 'none'; 
     607                                        } 
     608                                        else 
     609                                                _img_status_contact.style.display = 'block'; 
    505610                                break; 
    506611                                case 'subscribe' : 
     
    613718                                if ( _node.hasChildNodes() ) 
    614719                                { 
     720                                        _img_status_contact.style.display = 'block'; 
    615721                                        switch ( _node.nodeName ) 
    616722                                        { 
     
    695801                _ldap = arguments[3]; 
    696802                _menu = arguments[4]; 
     803                _cookies = arguments[5]; 
    697804        } 
    698805 
  • trunk/instant_messenger/js/windows.js

    r311 r318  
    5656                                'button' : _button, 
    5757                                'content' : _content, 
     58                                'close' : function() 
     59                                { 
     60                                        _button(_window.childNodes[1].childNodes[2].childNodes[0]); 
     61                                }, 
    5862                                'focus' : _focus, 
     63                                'hidden' : function() 
     64                                { 
     65                                        _button(_window.childNodes[1].childNodes[2].childNodes[2]); 
     66                                }, 
    5967                                'icon' : _icon, 
     68                                'loading' : function() 
     69                                { 
     70                                        var _information = top.document.createElement('span'); 
     71                                                _information.appendChild( 
     72                                                        top.document.createTextNode(imGetLang('Loading')) 
     73                                                ); 
     74 
     75                                        var _loading = top.document.createElement('div'); 
     76                                                _loading.className = 'loading'; 
     77                                                _loading.appendChild(_information); 
     78 
     79                                        _content.call(this, _loading); 
     80                                }, 
    6081                                'position' : _position, 
     82                                'show' : function() 
     83                                { 
     84                                        _window.style.display = 'block'; 
     85                                }, 
    6186                                'size' : _size, 
    6287                                'title' : _title 
     
    106131                                delete _all_windows[w.id]; 
    107132                        break; 
     133                        case 'minimize' : 
     134                                w.style.display = 'none'; 
     135                        break; 
    108136                        case 'maximize' : 
    109137                                if ( !w.getAttribute('wParams') ) 
    110138                                { 
    111139                                        var _wParams  = (parseFloat(w.style.width) - 13); 
    112                                                 _wParams += ':' + parseFloat(w.childNodes[2].firstChild.style.height); 
     140                                                _wParams += ':' + parseFloat(w.childNodes[2].firstChild.style.maxHeight); 
    113141                                                _wParams += ':' + parseFloat(w.style.left); 
    114142                                                _wParams += ':' + parseFloat(w.style.right); 
     
    122150                                        w.style.height = "100%"; 
    123151                                        w.style.width = "100%"; 
     152 
     153                                        var _style = w.childNodes[2].firstChild.getAttribute('style'); 
     154                                        if ( typeof _style == 'object' && _style.cssText ) 
     155                                                _style = _style.cssText; 
     156 
     157                                        if ( w.childNodes[2].firstChild.style.cssText ) 
     158                                                w.childNodes[2].firstChild.style.cssText = ''; 
     159 
     160                                        _style = _style.replace(/max-height: ?\d+;?/i, ''); 
     161 
     162                                        w.childNodes[2].firstChild.setAttribute('style', _style); 
    124163 
    125164                                        w.childNodes[2].firstChild.style.height = (_bwr.height - 41) + "px"; 
     
    182221                                } 
    183222                        break; 
    184                         case 'minimize' : 
    185                                 w.style.display = 'none'; 
    186                         break; 
    187223                } 
    188224        } 
     
    271307 
    272308                if ( typeof pHeight == 'number' && !isNaN(pHeight) ) 
    273                         this.wc.style.height = pHeight + 'px'; 
     309                        this.wc.style.maxHeight = pHeight + 'px'; 
    274310        } 
    275311 
     
    285321        { 
    286322                var _argv = arguments; 
    287                 this._TARGET = ( _argv[_argv.length - 1].id ) ? 
    288                         _argv[_argv.length - 1] : document.body; 
     323                var _argc = _argv.length; 
     324                if ( (_argv[_argc - 1] != null) && (_argv[_argc - 1]).id ) 
     325                                this._TARGET = _argv[_argc - 1]; 
     326                else 
     327                        this._TARGET = top.document.body; 
    289328 
    290329                _xtools = arguments[0]; 
  • trunk/instant_messenger/setup/phpgw_pt-br.lang

    r311 r318  
    77Added information!      instant_messenger       pt-br   Informações Adicionadas! 
    88Authorization   instant_messenger       pt-br   Autorização 
    9 available       instant_messenger       pt-br   Conectado 
     9available       instant_messenger       pt-br   Disponível 
    1010away    instant_messenger       pt-br   Ausente 
    1111Birthday        instant_messenger       pt-br   Aniversário 
     
    2121Delete  instant_messenger       pt-br   Remover 
    2222Description     instant_messenger       pt-br   Descrição 
    23 dnd     instant_messenger       pt-br   Desconectado 
     23dnd     instant_messenger       pt-br   Não Perturbe 
    2424deny    instant_messenger       pt-br   Negar 
    2525Error in the message!   instant_messenger       pt-br   Erro na mensagem! 
     
    3030instant_messenger       common  pt-br   Mensageiro Instantâneo 
    3131instant_messenger_t     instant_messenger       pt-br   Mensageiro Instantâneo 
     32Information Contacts    instant_messenger       pt-br   Informações do Contato 
    3233Information     instant_messenger       pt-br   Informações Adicionais 
    3334Information User        instant_messenger       pt-br   Informações Pessoais 
     
    7980Update  instant_messenger       pt-br   Atualizar 
    8081Username        instant_messenger       pt-br   Username 
    81 unavailable     instant_messenger       pt-br   Não Perturbe 
     82unavailable     instant_messenger       pt-br   Desconectado 
    8283Vcard   instant_messenger       pt-br   Vcard 
    8384You desire to register in service IM?   instant_messenger       pt-br   Você deseja registrar no serviço IM? 
  • trunk/instant_messenger/templates/default/config.tpl

    r265 r318  
    11<!-- BEGIN header --> 
     2<script type="text/javascript" src="instant_messenger/js/connector.js"></script> 
     3<script type="text/javascript" src="instant_messenger/js/xtools.js"></script> 
     4<script type="text/javascript" src="instant_messenger/controller.php?act=j.setup"></script> 
     5<script type="text/javascript"> 
     6        var PostForm = new constructScript; 
     7</script> 
    28<form method="POST" action="{action_url}"> 
    39<table border="0" align="center"> 
     
    1824   <tr bgcolor="{row_on}"> 
    1925    <td>Digite o nome do Servidor Jabber:</td> 
    20     <td><input id="IM_name_jabber" name="newsettings[name_jabber]" value="{value_name_jabber}"></td> 
     26    <td><input type="text" id="IM_name_jabber" name="newsettings[name_jabber]" value="{value_name_jabber}"></td> 
    2127   </tr> 
    2228 
    2329   <tr bgcolor="{row_off}"> 
    2430    <td>Digite Nome da Conexão:</td> 
    25     <td><input id="IM_resource_jabber" name="newsettings[resource_jabber]" value="{value_resource_jabber}"></td> 
     31    <td><input type="text" id="IM_resource_jabber" name="newsettings[resource_jabber]" value="{value_resource_jabber}"></td> 
    2632   </tr> 
    2733 
    2834   <tr bgcolor="{row_on}"> 
    2935    <td>Digite a porta do Servidor Jabber:</td> 
    30     <td><input id="IM_port_jabber" name="newsettings[port_jabber]" value="{value_port_jabber}"></td> 
     36    <td><input type="text" id="IM_port_jabber" name="newsettings[port_jabber]" value="{value_port_jabber}"></td> 
    3137   </tr> 
    3238    
     
    4147   <tr bgcolor="{row_on}"> 
    4248    <td>Digite o Ip do Servidor WebJabber:</td> 
    43     <td><input id="IM_server_webjabber" name="newsettings[server_webjabber]" value="{value_server_webjabber}"></td> 
     49    <td><input type="text" id="IM_server_webjabber" name="newsettings[server_webjabber]" value="{value_server_webjabber}"></td> 
    4450   </tr> 
    4551 
     
    5460   <tr bgcolor="{row_on}"> 
    5561    <td>Servidor Ldap:</td> 
    56     <td><input id="IM_server_ldap_jabber" name="newsettings[server_ldap_jabber]" value="{value_server_ldap_jabber}"></td> 
     62    <td><input type="text" id="IM_server_ldap_jabber" name="newsettings[server_ldap_jabber]" value="{value_server_ldap_jabber}"></td> 
    5763   </tr> 
    5864 
    5965   <tr bgcolor="{row_off}"> 
    6066    <td>Contexto:</td> 
    61     <td><input id="IM_context_ldap_jabber" name="newsettings[context_ldap_jabber]" value="{value_context_ldap_jabber}" size="30"></td> 
     67    <td><input type="text" id="IM_context_ldap_jabber" name="newsettings[context_ldap_jabber]" value="{value_context_ldap_jabber}" size="30"></td> 
    6268   </tr> 
    6369 
    6470   <tr bgcolor="{row_on}"> 
    6571    <td>Usuário Ldap:</td> 
    66     <td><input id="IM_user_ldap_jabber" name="newsettings[user_ldap_jabber]" value="{value_user_ldap_jabber}" size="30"></td> 
     72    <td><input type="text" id="IM_user_ldap_jabber" name="newsettings[user_ldap_jabber]" value="{value_user_ldap_jabber}" size="30"></td> 
    6773   </tr> 
    6874 
    6975   <tr bgcolor="{row_off}"> 
    7076    <td>Password:</td> 
    71     <td><input type="password" name="newsettings[password_ldap_jabber]" value="{value_password_ldap_jabber}"></td> 
     77    <td><input type="password" id="IM_password_ldap_jabber" name="newsettings[password_ldap_jabber]" value="{value_password_ldap_jabber}"></td> 
    7278   </tr> 
    7379<!-- END body --> 
     
    7682  <tr> 
    7783    <td colspan="2" align="center"> 
    78       <input type="submit" name="submit" value="{lang_submit}"> 
     84      <input type="submit" name="submit" value="{lang_submit}" onclick="javascript:PostForm.sendf(document);return false;" > 
    7985      <input type="submit" name="cancel" value="{lang_cancel}"> 
    8086    </td> 
  • trunk/instant_messenger/templates/default/css/common.css

    r305 r318  
    9292} 
    9393 
     94div.loading 
     95{ 
     96        background: #fdd url(../images/loading.gif) no-repeat 1px 1px; 
     97        border: 1px dashed #f00; 
     98        margin: 2px; 
     99        padding: 3px 3px 3px 20px; 
     100        text-align: center; 
     101} 
     102 
     103span.message_time 
     104{ 
     105        color: #aaa; 
     106        font: 8pt Verdana, Arial, Helvetica, sans-serif; 
     107} 
     108 
    94109.font_menu 
    95110{ 
  • trunk/instant_messenger/templates/default/css/window.css

    r311 r318  
    2121} 
    2222 
    23 #instant_messenger_content .icon 
    24 { 
    25         position:absolute !important; 
    26         height: 15px; 
    27         width: 15px; 
    28 } 
    29  
    3023#instant_messenger_content .titulo 
    3124{ 
     
    4033} 
    4134 
     35#instant_messenger_content .titulo .icon 
     36{ 
     37        float:left; 
     38        height: 15px; 
     39        width: 15px; 
     40} 
     41 
    4242#instant_messenger_content .titulo span 
    4343{ 
    4444        float:left; 
    45         margin-left: 17px; 
     45        margin-left: 2px; 
    4646} 
    4747 
    48 #instant_messenger_content .titulo div div 
     48#instant_messenger_content .buttons 
     49{ 
     50        position:absolute !important; 
     51        right:3px !important; 
     52        width:50px !important; 
     53} 
     54 
     55#instant_messenger_content .titulo .buttons div 
    4956{ 
    5057        cursor: pointer; 
     
    5461        width: 13px; 
    5562        height:13px; 
    56 } 
    57  
    58 #instant_messenger_content .buttons 
    59 { 
    60         position:absolute !important; 
    61         right:3px !important; 
    62         width:50px !important; 
    6363} 
    6464 
  • trunk/instant_messenger/xsl/contacts.xsl

    r311 r318  
    2929 
    3030        <xsl:template match="*" mode="contacts"> 
    31                 <div style="background:url({$path}templates/default/images/unavailable.gif) no-repeat 15px;padding-left:30px;cursor:pointer;display:block;" id="contact_{@jid}" idgroup="{group}" idname="{@name}" jid="{@jid}"> 
     31                <div style="background:url({$path}templates/default/images/unavailable.gif) no-repeat 15px;padding-left:30px;cursor:pointer;" id="contact_{@jid}" idgroup="{group}" idname="{@name}" jid="{@jid}"> 
    3232                        <xsl:choose> 
    3333                                <xsl:when test="@name"> 
  • trunk/instant_messenger/xsl/layer.xsl

    r305 r318  
    1313                        <span id="im_layer_nickname"><xsl:value-of select="$nickname" /></span><br/><br/> 
    1414                        <img src="../instant_messenger/templates/default/images/addBuddy1.gif" style="cursor:pointer;" title="{$lang2}" alt="{$lang2}"/> 
    15                         <!-- 
    16                         <img src="../instant_messenger/templates/default/images/console_prefs1.png" style="cursor:pointer;" onclick="javascript:templates.preferences('span_preferences');" title="{$lang3}" alt="{$lang3}"/> 
    17                         --> 
     15                        <img src="../instant_messenger/templates/default/images/console_prefs1.png" onclick="im_preferences.load()" style="cursor:pointer;" title="{$lang3}" alt="{$lang3}"/> 
    1816                        <span id="span_preferences"></span><br/> 
    1917                </div> 
  • trunk/instant_messenger/xsl/message_new.xsl

    r305 r318  
    44 
    55        <xsl:param name="nickname" /> 
     6        <xsl:param name="time" /> 
    67 
    78        <xsl:template match="message"> 
     9                <xsl:if test="delay"> 
     10                        <span class="message_time"> 
     11                                <xsl:text>mensagem enviada em </xsl:text> 
     12                                <xsl:value-of select="substring(delay/@stamp, 9, 2)"/>/ 
     13                                <xsl:value-of select="substring(delay/@stamp, 6, 2)"/>/ 
     14                                <xsl:value-of select="substring(delay/@stamp, 1, 4)"/> 
     15                                <xsl:text> as </xsl:text> 
     16                                <xsl:value-of select="substring(delay/@stamp, 12, 2) - 3"/> 
     17                                <xsl:value-of select="substring(delay/@stamp, 14, 3)"/> 
     18                                <br/> 
     19                        </span> 
     20                </xsl:if> 
     21                <span class="message_time">[<xsl:value-of select="$time"/>] </span> 
    822                <b><xsl:value-of select="$nickname"/>:</b><br/> 
    923                <xsl:value-of select="body"/> 
  • trunk/instant_messenger/xsl/mysettings.xsl

    r260 r318  
    11<?xml version="1.0" encoding="ISO-8859-1"?> 
    22<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
    3 <xsl:output method="html" omit-xml-declaration="yes"/> 
     3        <xsl:output method="html" omit-xml-declaration="yes"/> 
    44 
    5 <xsl:template match="settings"> 
    6           <div id="im_preferences" style="margin:5px"> 
    7                   <fieldset><legend> <xsl:value-of select="lang1"/> :</legend> 
    8                           <input id="ch_offline" type="checkbox" /> <xsl:value-of select="lang2"/> 
    9                   </fieldset> 
    10                   <br /> 
    11                   <fieldset><legend> <xsl:value-of select="lang3" /> : </legend>         
    12                           <xsl:value-of select="lang4"/><input id="time_xa_im" type="input" size="2" maxlength="2" style="margin:0px 3px" onclick="javascript:im.focus_select(this,event);" onmousedown="javascript:im.focus_select(this,event);"/><xsl:value-of select="lang5"/> 
    13                   </fieldset>            
    14                   <br />         
    15                   <fieldset> 
    16                           <legend> <xsl:value-of select="lang6" /> :</legend> 
    17                   <input id="rd_nm" type="radio" name="rd_aviso" /> <xsl:value-of select="lang7" /> <br /> 
    18                           <input id="rd_ch" type="radio" name="rd_aviso" /> <xsl:value-of select="lang8" /> 
    19                   </fieldset> 
    20                         <br/> 
    21                         <input type="button" value="{lang9}" onclick="javascript:im.set_preferences();"/> 
    22                         <input type="button" value="{lang10}" onclick="javascript:im_window.window_close('my_settings_im');"/> 
    23           </div> 
    24 </xsl:template> 
     5        <xsl:param name="lang1" /> 
     6        <xsl:param name="lang2" /> 
     7        <xsl:param name="lang3" /> 
     8        <xsl:param name="lang4" /> 
     9        <xsl:param name="lang5" /> 
     10        <xsl:param name="lang6" /> 
     11        <xsl:param name="lang7" /> 
     12        <xsl:param name="lang8" /> 
     13        <xsl:param name="lang9" /> 
     14        <xsl:param name="lang10" /> 
    2515 
     16        <xsl:template match="settings"> 
     17                <div id="im_preferences"> 
     18                        <fieldset> 
     19                                <legend> <xsl:value-of select="$lang1"/> : </legend> 
     20                                <input id="ch_offline" type="checkbox" />  
     21                                <label for="ch_offline"><xsl:value-of select="$lang2"/></label> 
     22                        </fieldset> 
     23                        <br /> 
     24                        <fieldset> 
     25                                <legend> <xsl:value-of select="$lang3" /> : </legend>    
     26                                <label for="time_xa_im"><xsl:value-of select="$lang4"/></label> 
     27                                <input id="time_xa_im" type="input" size="2" maxlength="2" style="margin:0px 3px" onclick="im_preferences.getfocus(this, event);" onmousedown="im_preferences.getfocus(this, event);"/> 
     28                                <label for="time_xa_im"><xsl:value-of select="$lang5"/></label> 
     29                        </fieldset>              
     30                        <br />   
     31                        <fieldset> 
     32                                <legend> <xsl:value-of select="$lang6" /> : </legend> 
     33                                <input id="rd_nm" type="radio" name="rd_aviso" /> <label for="rd_nm"><xsl:value-of select="$lang7" /></label> 
     34                                <br /> 
     35                                <input id="rd_ch" type="radio" name="rd_aviso" /> <label for="rd_ch"><xsl:value-of select="$lang8" /></label> 
     36                        </fieldset> 
     37                </div> 
     38                <br/> 
     39                <input type="button" value="{$lang9}"/> 
     40                <input type="button" value="{$lang10}"/> 
     41        </xsl:template> 
    2642</xsl:stylesheet> 
Note: See TracChangeset for help on using the changeset viewer.