Changeset 327


Ignore:
Timestamp:
06/24/08 17:09:46 (16 years ago)
Author:
niltonneto
Message:
 
Location:
trunk/instant_messenger
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/instant_messenger/inc/Controller.class.php

    r305 r327  
    188188                file_exists($file) 
    189189                        or die(__CLASS__ . ' [ ERROR #19 ] :: the file that has the class was not opened'); 
     190 
     191                $debug = $pSectionItem->parentNode->getAttribute('debug'); 
     192                if ( $debug && ($debug === 'true') ) 
     193                        return file_get_contents($file); 
    190194 
    191195                $packed_file = "{$pPath}/.packer.{$pPrefix}{$js}{$pSuffix}"; 
  • trunk/instant_messenger/inc/Jabberd2.abstract.php

    r323 r327  
    161161                if ( !$pPresence ) 
    162162                        $this->presence(); 
    163  
    164                 $type = ( isset($pPresence['type']) ) ? $pPresence['type'] : NULL; 
    165                 $to = ( isset($pPresence['to']) ) ? $pPresence['to'] : NULL; 
    166                 $show = ( isset($pPresence['show']) ) ? $pPresence['show'] : NULL; 
    167                 $status = ( isset($pPresence['status']) ) ? $pPresence['status'] : NULL; 
    168                 $priority = ( isset($pPresence['priority']) ) ? $pPresence['priority'] : NULL; 
    169  
    170                 $this->presence($type, $to, $show, $status, $priority); 
     163                else 
     164                { 
     165                        $type = ( isset($pPresence['type']) ) ? $pPresence['type'] : NULL; 
     166                        $to = ( isset($pPresence['to']) ) ? $pPresence['to'] : NULL; 
     167                        $show = ( isset($pPresence['show']) ) ? $pPresence['show'] : NULL; 
     168                        $status = ( isset($pPresence['status']) ) ? $pPresence['status'] : NULL; 
     169                        $priority = ( isset($pPresence['priority']) ) ? $pPresence['priority'] : NULL; 
     170 
     171                        $this->presence($type, $to, $show, $status, $priority); 
     172                } 
    171173        } 
    172174 
  • trunk/instant_messenger/inc/class.Ujabber.inc.php

    r323 r327  
    5959                        return "disconnected"; 
    6060 
     61                $this->get_last_access_user(); 
     62 
    6163                if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ) 
    6264                { 
     
    7476                        $buffer = ''; 
    7577 
    76                         while ( ( connection_aborted() === 0 ) && time() - $init < 50 ) 
    77                         { 
     78                        $send_last_access = time(); 
     79 
     80                        while ( (connection_aborted() === 0) && (time() - $init < 50) ) 
     81                        { 
     82                                if ( (time() - $send_last_access) > 15 ) 
     83                                { 
     84                                        $this->get_last_access_user(); 
     85                                        $send_last_access = time(); 
     86                                } 
     87 
    7888                                # read from server and write in the client 
    7989                                $xml = $this->readSocket(); 
     
    104114        } 
    105115 
    106         public final function checkConnection() 
    107         { 
    108                 $this->get_last_access_user(); 
    109                 return $this->isConnected(); 
     116        public final function update() 
     117        { 
     118                $presence = $_COOKIE['IM_presence']; 
     119 
     120                if ( !$presence ) 
     121                        $presence = 'available'; 
     122 
     123                switch ( $presence ) 
     124                { 
     125                        case 'away': 
     126                        case 'dnd': 
     127                        case 'xa': 
     128                                $presence = array('show' => $presence); 
     129                        break; 
     130                        case 'available': 
     131                        case 'unavailable': 
     132                                $presence = array('type' => $presence); 
     133                        break; 
     134                } 
     135 
     136                $this->getContacts(); 
     137                $this->setPresence(array('type'=>'unavailable')); 
     138                $this->setPresence($presence); 
     139 
     140                print_r($presence); 
    110141        } 
    111142 
  • trunk/instant_messenger/inc/controller.xml

    r323 r327  
    1313                <item param="xs" section="xsl" /> 
    1414                <item param="t" section="php" /> 
     15                <item param="$this" section="php" /> 
    1516        </controller-contentes> 
    1617        <controller-sections> 
    1718                <css></css> 
    18                 <js path="/var/www/expresso/instant_messenger/js" suffix=".js"> 
     19                <js path="/var/www/expresso/instant_messenger/js" suffix=".js" debug="true"> 
    1920                        <item ref="client" js="client" /> 
    2021                        <item ref="connector" js="connector" /> 
     
    5960                        <item ref="paused" class="Ujabber" method="paused" prefix="class." suffix=".inc.php" /> 
    6061                        <item ref="checkConnection" class="Ujabber" method="checkConnection" prefix="class." suffix=".inc.php" /> 
     62                        <item ref="update" class="Ujabber" method="update" prefix="class." suffix=".inc.php" /> 
    6163                </php> 
    6264                <xml></xml> 
  • trunk/instant_messenger/instant_messenger.define.php

    r318 r327  
    11<?php  
    22define('IM_NAME_JABBER', 'im.pr.gov.br'); 
    3 define('IM_RESOURCE_JABBER', 'IM_ALE'); 
    4 define('IM_PORT_JABBER', '8884'); 
     3define('IM_RESOURCE_JABBER', 'IM_PROD'); 
     4define('IM_PORT_JABBER', '8883'); 
    55define('IM_SERVER_WEBJABBER', 'im.pr.gov.br'); 
    66define('IM_SERVER_LDAP_JABBER', 'ldap://ldap.eparana.parana'); 
  • trunk/instant_messenger/js/client.js

    r323 r327  
    149149                        if ( !_disconnected ) 
    150150                        { 
    151                                 _conn.go('$this.Ujabber.getContacts'); 
     151                                _conn.go('t.update'); 
     152 
    152153                                setTimeout(function() 
    153154                                { 
     
    189190 
    190191                var local; 
    191                 if ( (local = top.document.getElementById('user_info')) ) 
    192                 { 
    193                         local.firstChild.style.marginLeft = '30px'; 
     192                if ( (local = top.document.getElementById('divStatusBar')) ) 
     193                { 
     194                        // tentando colocar os icones em local que não seja mexido. 
     195                        // VERIFICAR 
     196                        var _div = top.document.createElement('div'); 
     197                        _div.appendChild(local.parentNode.removeChild(local.previousSibling)); 
     198                        local.parentNode.insertBefore(_div, local); 
     199                        //_div.appendChild(local); 
     200 
     201                        //local = _div; 
     202 
     203                        local.style.paddingLeft = '30px'; 
    194204 
    195205                        var _status = top.document.createElement('div'); 
    196206                                _status.setAttribute('id', 'im_status'); 
    197                                 _status.style.height = '15px'; 
    198                                 _status.style.margin = '0 0 0 10px'; 
    199                                 _status.style.padding = '0px'; 
    200                                 _status.style.width = '15px'; 
    201207                                _status.style.background = 'no-repeat'; 
    202208                                _status.style.backgroundImage = 'url(' + im_unavailable.src + ')'; 
    203209                                _status.style.float = 'left'; 
     210                                _status.style.height = '15px'; 
     211                                _status.style.left = '20px'; 
     212                                _status.style.margin = '0 0 0 10px'; 
     213                                _status.style.padding = '0px'; 
    204214                                _status.style.position = 'absolute'; 
     215                                _status.style.width = '15px'; 
    205216 
    206217                        local.insertBefore(_status, local.firstChild); 
     
    221232                                _menu_img.style.background = 'no-repeat'; 
    222233                                _menu_img.style.backgroundImage = 'url(' + im_fast_menu.src + ')'; 
     234                                _menu_img.style.float = 'left'; 
    223235                                _menu_img.style.height = '10px'; 
     236                                _menu_img.style.left = '23px'; 
    224237                                _menu_img.style.margin = '0px'; 
    225238                                _menu_img.style.padding = '0px'; 
    226239                                _menu_img.style.position = 'absolute'; 
    227240                                _menu_img.style.width = '10px'; 
    228                                 _menu_img.style.float = 'left'; 
    229241                        local.insertBefore(_menu_img, local.firstChild); 
    230242 
     
    288300                } 
    289301 
    290                 function _check_connection() 
    291                 { 
    292                         if ( !_disconnected ) 
    293                                 _conn.go('t.checkConnection'); 
    294                 } 
    295  
    296302                function Client() 
    297303                { 
    298304                        _request(); 
    299305                        setTimeout(_contacts, 3000); 
    300                         window.setInterval(_check_connection, 20000); 
    301306                } 
    302307 
  • trunk/instant_messenger/js/connector.js

    r318 r327  
    7171                                                        catch(_e) 
    7272                                                        { 
    73                                                                 alert("#stream\n\n" + _e + "\n\n" + _e.description); 
     73                                                                //alert("#stream\n\n" + _e + "\n\n" + _e.description); 
    7474                                                        } 
    7575 
     
    103103                                                                        catch(_e) 
    104104                                                                        { 
    105                                                                                 alert("#request\n\n" + _e + "\n\n" + _e.description); 
     105                                                                                //alert("#request\n\n" + _e + "\n\n" + _e.description); 
    106106                                                                        } 
    107107 
  • trunk/instant_messenger/js/jabber.js

    r323 r327  
    185185                        _win = _chat(id); 
    186186                        _win.title(el.getAttribute('idname')); 
    187                         _win.icon(eval('im_' + el.getAttribute('status') + '.src')); 
     187                        if ( el.getAttribute('status') ) 
     188                                _win.icon(eval('im_' + el.getAttribute('status') + '.src')); 
    188189                } 
    189190                else 
     
    225226                if ( _contact_list ) 
    226227                { 
    227                         _conn.go('$this.Ujabber.setPresence', 'type=unavailable'); 
    228                         _setPresence(); 
    229                         _ldap.photo( 
    230                                 'im_avatar', 
    231                                 _win_contact.wc.firstChild 
    232                         ); 
    233                         _conn.go('$this.Ujabber.getVcard','jid=this'); 
     228                        var _presence; 
     229                        if ( !(_presence = _cookies.get('IM_presence')) ) 
     230                                _presence = 'available'; 
     231 
     232                        var _img_status = eval('im_' + _presence + '.src'); 
     233 
     234                        if ( _img_status ) 
     235                        { 
     236                                _win_contact.icon(_img_status); 
     237 
     238                                var _status = top.document.getElementById('im_status'); 
     239                                if ( _status ) 
     240                                        _status.style.backgroundImage = 'url(' + _img_status + ')'; 
     241                        } 
     242 
     243                        _ldap.photo('im_avatar', _win_contact.wc.firstChild); 
     244 
    234245                        function _click(e) 
    235246                        { 
    236247                                var el = ( e.target ) ? e.target : e.srcElement; 
    237                                 //alert(e.button); 
    238248                                if ( (e.button == 0 && !document.all) || (e.button == 1 && document.all) ) 
    239249                                        _openChat(el); 
     
    307317                                } 
    308318                        } 
     319                        function _show_hidden_group(e) 
     320                        { 
     321                                var el = ( e.target ) ? e.target : e.srcElement; 
     322                                var _display = "none"; 
     323                                var _image = im_group_close.src; 
     324 
     325                                if ( el.style.backgroundImage.indexOf('group_open') < 0 ) 
     326                                { 
     327                                        _display = "block"; 
     328                                        _image = im_group_open.src; 
     329                                } 
     330 
     331                                el.style.backgroundImage = 'url(' + _image + ')'; 
     332 
     333                                el = el.nextSibling; 
     334                                while ( el.getAttribute('jid') ) 
     335                                { 
     336                                        if ( _display == 'block' ) 
     337                                        { 
     338                                                var _show_all = _cookies.get('IM_unavailable'); 
     339                                                if ( (el.style.backgroundImage.indexOf('unavailable') > -1) && (_show_all == 'hidden') ) 
     340                                                        _display = 'none'; 
     341                                        } 
     342                                        el.style.display = _display; 
     343                                        el = el.nextSibling; 
     344                                        if ( el && el.nextSibling ) 
     345                                                el = el.nextSibling; 
     346                                } 
     347                        } 
    309348                        function _hover(e) 
    310349                        { 
     
    323362                                        _config(_contact, 'onmouseover', _hover); 
    324363                                        _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); 
     364                                        // it is a group 
     365                                        if ( !(_contact.getAttribute('jid')) ) 
     366                                                _config(_contact, 'onclick', _show_hidden_group); 
     367                                        // it is a contact 
     368                                        else 
     369                                        { 
     370                                                if ( _show_all != 'hidden' ) 
     371                                                        _contact.style.display = 'block'; 
    330372                                                _config(_contact, 'onmouseup', _click); 
    331                                         } 
    332                                         else 
    333                                         { 
    334                                                 _config(_contact, 'onclick', 
    335                                                 function(e) 
    336                                                 { 
    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  
    349                                                         el = el.nextSibling; 
    350                                                         while ( el.getAttribute('jid') ) 
    351                                                         { 
    352                                                                 if ( _display == 'block' ) 
    353                                                                 { 
    354                                                                         var _show_all = _cookies.get('IM_unavailable'); 
    355                                                                         if ( (el.style.backgroundImage.indexOf('unavailable') > -1) && (_show_all == 'hidden') ) 
    356                                                                                 _display = 'none'; 
    357                                                                 } 
    358                                                                 el.style.display = _display; 
    359                                                                 el = el.nextSibling; 
    360                                                                 if ( el && el.nextSibling ) 
    361                                                                         el = el.nextSibling; 
    362                                                         } 
    363                                                 }); 
    364373                                        } 
    365374                                } 
     
    371380        function _setPresence() 
    372381        { 
     382                if ( !(_cookies) ) 
     383                        return false; 
     384 
    373385                var _presence = false; 
    374386                var _pPresence; 
     
    506518        { 
    507519                if ( pIq.firstChild.getAttribute("seconds") != 0 ) 
    508                         _conn.go('$this.Ujabber.getContacts'); 
     520                        _conn.go('t.update'); 
    509521        } 
    510522 
     
    523535                { 
    524536                        _contact_list.style.backgroundImage = 'url(' + im_composing.src + ')'; 
    525                         setTimeout(function(){_contact_list.style.backgroundImage = 'url(' + eval('im_' + _contact_list.getAttribute('status') + '.src') + ')';}, 10000); 
     537                        setTimeout(function() 
     538                        { 
     539                                _contact_list.style.backgroundImage = 'url(' + eval('im_' + _contact_list.getAttribute('status') + '.src') + ')'; 
     540                        }, 10000); 
    526541                } 
    527542 
     
    593608                var _win_chat = _window.get('chat' + _from); 
    594609 
    595                 _img_status_contact.setAttribute('status', _presence_type); 
    596  
    597610                if ( _mensagem_status_contact ) 
    598611                { 
     
    607620                                case 'available' : 
    608621                                case 'unavailable' : 
     622                                        _img_status_contact.setAttribute('status', _presence_type); 
     623 
    609624                                        if ( _img_status_contact ) 
    610625                                                _img_status_contact.style.backgroundImage = 'url(' + eval('im_' + _presence_type + '.src') + ')'; 
     
    733748                                        { 
    734749                                                case "show" : 
     750                                                        var _show = _node.firstChild.nodeValue; 
     751                                                        _img_status_contact.setAttribute('status', _show); 
    735752                                                        if ( _img_status_contact ) 
    736                                                                 _img_status_contact.style.backgroundImage = 'url(' + eval('im_' + _node.firstChild.nodeValue + '.src') + ')'; 
     753                                                                _img_status_contact.style.backgroundImage = 'url(' + eval('im_' + _show + '.src') + ')'; 
    737754                                                        if ( _win_chat ) 
    738                                                                 _win_chat.icon(eval('im_' + _node.firstChild.nodeValue + '.src')); 
     755                                                                _win_chat.icon(eval('im_' + _show + '.src')); 
    739756                                                break; 
    740757                                                case "status" : 
     
    747764                                                break; 
    748765                                                default : 
     766                                                        _img_status_contact.setAttribute('status', 'available'); 
    749767                                                        if ( _img_status_contact ) 
    750768                                                                _img_status_contact.style.backgroundImage = 'url(' + im_available.src + ')'; 
  • trunk/instant_messenger/js/preferences.js

    r323 r327  
    142142 
    143143                // New Message 
     144                /* 
    144145                if(top.document.getElementById('rd_nm').checked) 
    145146                { 
     
    157158                else 
    158159                        preferences += 'rd_ch:false;'; 
     160                */ 
    159161 
    160162                // Write Cookie 
     
    196198        } 
    197199 
     200        function _show_hidden_group() 
     201        { 
     202                if ( !(arguments[0]) ) 
     203                        return false; 
     204 
     205                var show = 'block'; 
     206                if ( !(arguments[0].checked) ) 
     207                        show = 'none'; 
     208 
     209                var el = top.document.getElementById('im_contact_list'); 
     210                if ( el && (el = el.firstChild) ) 
     211                        while ( el ) 
     212                        { 
     213                                // it is a contact 
     214                                if ( (el.nodeName.toLowerCase() == 'div') && el.getAttribute('jid') ) 
     215                                        if ( el.style.backgroundImage.indexOf('unavailable') > -1 ) 
     216                                                el.style.display = show; 
     217                                el = el.nextSibling; 
     218                        } 
     219        } 
     220 
    198221        function Preferences() 
    199222        { 
     
    206229        Preferences.prototype.load                       = _load_window; 
    207230        Preferences.prototype.getfocus           = focus_select; 
     231 
     232        Preferences.prototype.showHiddenGroup = _show_hidden_group; 
     233 
    208234        top.window.im_preferences                        = new Preferences; 
    209235        _config(top.window.document, 'onmousemove', _timeOut); 
  • trunk/instant_messenger/xsl/contacts.xsl

    r318 r327  
    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;" 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;display:none;" id="contact_{@jid}" idgroup="{group}" idname="{@name}" jid="{@jid}"> 
    3232                        <xsl:choose> 
    3333                                <xsl:when test="@name"> 
  • trunk/instant_messenger/xsl/mysettings.xsl

    r318 r327  
    1818                        <fieldset> 
    1919                                <legend> <xsl:value-of select="$lang1"/> : </legend> 
    20                                 <input id="ch_offline" type="checkbox" />  
     20                                <input id="ch_offline" type="checkbox" onclick="im_preferences.showHiddenGroup(this);" />  
    2121                                <label for="ch_offline"><xsl:value-of select="$lang2"/></label> 
    2222                        </fieldset> 
     
    2929                        </fieldset>              
    3030                        <br />   
     31                        <!-- 
    3132                        <fieldset> 
    3233                                <legend> <xsl:value-of select="$lang6" /> : </legend> 
     
    3536                                <input id="rd_ch" type="radio" name="rd_aviso" /> <label for="rd_ch"><xsl:value-of select="$lang8" /></label> 
    3637                        </fieldset> 
     38                        --> 
    3739                </div> 
    3840                <br/> 
Note: See TracChangeset for help on using the changeset viewer.