Changeset 327
- Timestamp:
- 06/24/08 17:09:46 (16 years ago)
- Location:
- trunk/instant_messenger
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/instant_messenger/inc/Controller.class.php
r305 r327 188 188 file_exists($file) 189 189 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); 190 194 191 195 $packed_file = "{$pPath}/.packer.{$pPrefix}{$js}{$pSuffix}"; -
trunk/instant_messenger/inc/Jabberd2.abstract.php
r323 r327 161 161 if ( !$pPresence ) 162 162 $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 } 171 173 } 172 174 -
trunk/instant_messenger/inc/class.Ujabber.inc.php
r323 r327 59 59 return "disconnected"; 60 60 61 $this->get_last_access_user(); 62 61 63 if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ) 62 64 { … … 74 76 $buffer = ''; 75 77 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 78 88 # read from server and write in the client 79 89 $xml = $this->readSocket(); … … 104 114 } 105 115 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); 110 141 } 111 142 -
trunk/instant_messenger/inc/controller.xml
r323 r327 13 13 <item param="xs" section="xsl" /> 14 14 <item param="t" section="php" /> 15 <item param="$this" section="php" /> 15 16 </controller-contentes> 16 17 <controller-sections> 17 18 <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"> 19 20 <item ref="client" js="client" /> 20 21 <item ref="connector" js="connector" /> … … 59 60 <item ref="paused" class="Ujabber" method="paused" prefix="class." suffix=".inc.php" /> 60 61 <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" /> 61 63 </php> 62 64 <xml></xml> -
trunk/instant_messenger/instant_messenger.define.php
r318 r327 1 1 <?php 2 2 define('IM_NAME_JABBER', 'im.pr.gov.br'); 3 define('IM_RESOURCE_JABBER', 'IM_ ALE');4 define('IM_PORT_JABBER', '888 4');3 define('IM_RESOURCE_JABBER', 'IM_PROD'); 4 define('IM_PORT_JABBER', '8883'); 5 5 define('IM_SERVER_WEBJABBER', 'im.pr.gov.br'); 6 6 define('IM_SERVER_LDAP_JABBER', 'ldap://ldap.eparana.parana'); -
trunk/instant_messenger/js/client.js
r323 r327 149 149 if ( !_disconnected ) 150 150 { 151 _conn.go('$this.Ujabber.getContacts'); 151 _conn.go('t.update'); 152 152 153 setTimeout(function() 153 154 { … … 189 190 190 191 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'; 194 204 195 205 var _status = top.document.createElement('div'); 196 206 _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';201 207 _status.style.background = 'no-repeat'; 202 208 _status.style.backgroundImage = 'url(' + im_unavailable.src + ')'; 203 209 _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'; 204 214 _status.style.position = 'absolute'; 215 _status.style.width = '15px'; 205 216 206 217 local.insertBefore(_status, local.firstChild); … … 221 232 _menu_img.style.background = 'no-repeat'; 222 233 _menu_img.style.backgroundImage = 'url(' + im_fast_menu.src + ')'; 234 _menu_img.style.float = 'left'; 223 235 _menu_img.style.height = '10px'; 236 _menu_img.style.left = '23px'; 224 237 _menu_img.style.margin = '0px'; 225 238 _menu_img.style.padding = '0px'; 226 239 _menu_img.style.position = 'absolute'; 227 240 _menu_img.style.width = '10px'; 228 _menu_img.style.float = 'left';229 241 local.insertBefore(_menu_img, local.firstChild); 230 242 … … 288 300 } 289 301 290 function _check_connection()291 {292 if ( !_disconnected )293 _conn.go('t.checkConnection');294 }295 296 302 function Client() 297 303 { 298 304 _request(); 299 305 setTimeout(_contacts, 3000); 300 window.setInterval(_check_connection, 20000);301 306 } 302 307 -
trunk/instant_messenger/js/connector.js
r318 r327 71 71 catch(_e) 72 72 { 73 alert("#stream\n\n" + _e + "\n\n" + _e.description);73 //alert("#stream\n\n" + _e + "\n\n" + _e.description); 74 74 } 75 75 … … 103 103 catch(_e) 104 104 { 105 alert("#request\n\n" + _e + "\n\n" + _e.description);105 //alert("#request\n\n" + _e + "\n\n" + _e.description); 106 106 } 107 107 -
trunk/instant_messenger/js/jabber.js
r323 r327 185 185 _win = _chat(id); 186 186 _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')); 188 189 } 189 190 else … … 225 226 if ( _contact_list ) 226 227 { 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 234 245 function _click(e) 235 246 { 236 247 var el = ( e.target ) ? e.target : e.srcElement; 237 //alert(e.button);238 248 if ( (e.button == 0 && !document.all) || (e.button == 1 && document.all) ) 239 249 _openChat(el); … … 307 317 } 308 318 } 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 } 309 348 function _hover(e) 310 349 { … … 323 362 _config(_contact, 'onmouseover', _hover); 324 363 _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'; 330 372 _config(_contact, 'onmouseup', _click); 331 }332 else333 {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 });364 373 } 365 374 } … … 371 380 function _setPresence() 372 381 { 382 if ( !(_cookies) ) 383 return false; 384 373 385 var _presence = false; 374 386 var _pPresence; … … 506 518 { 507 519 if ( pIq.firstChild.getAttribute("seconds") != 0 ) 508 _conn.go(' $this.Ujabber.getContacts');520 _conn.go('t.update'); 509 521 } 510 522 … … 523 535 { 524 536 _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); 526 541 } 527 542 … … 593 608 var _win_chat = _window.get('chat' + _from); 594 609 595 _img_status_contact.setAttribute('status', _presence_type);596 597 610 if ( _mensagem_status_contact ) 598 611 { … … 607 620 case 'available' : 608 621 case 'unavailable' : 622 _img_status_contact.setAttribute('status', _presence_type); 623 609 624 if ( _img_status_contact ) 610 625 _img_status_contact.style.backgroundImage = 'url(' + eval('im_' + _presence_type + '.src') + ')'; … … 733 748 { 734 749 case "show" : 750 var _show = _node.firstChild.nodeValue; 751 _img_status_contact.setAttribute('status', _show); 735 752 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') + ')'; 737 754 if ( _win_chat ) 738 _win_chat.icon(eval('im_' + _ node.firstChild.nodeValue+ '.src'));755 _win_chat.icon(eval('im_' + _show + '.src')); 739 756 break; 740 757 case "status" : … … 747 764 break; 748 765 default : 766 _img_status_contact.setAttribute('status', 'available'); 749 767 if ( _img_status_contact ) 750 768 _img_status_contact.style.backgroundImage = 'url(' + im_available.src + ')'; -
trunk/instant_messenger/js/preferences.js
r323 r327 142 142 143 143 // New Message 144 /* 144 145 if(top.document.getElementById('rd_nm').checked) 145 146 { … … 157 158 else 158 159 preferences += 'rd_ch:false;'; 160 */ 159 161 160 162 // Write Cookie … … 196 198 } 197 199 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 198 221 function Preferences() 199 222 { … … 206 229 Preferences.prototype.load = _load_window; 207 230 Preferences.prototype.getfocus = focus_select; 231 232 Preferences.prototype.showHiddenGroup = _show_hidden_group; 233 208 234 top.window.im_preferences = new Preferences; 209 235 _config(top.window.document, 'onmousemove', _timeOut); -
trunk/instant_messenger/xsl/contacts.xsl
r318 r327 29 29 30 30 <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}"> 32 32 <xsl:choose> 33 33 <xsl:when test="@name"> -
trunk/instant_messenger/xsl/mysettings.xsl
r318 r327 18 18 <fieldset> 19 19 <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);" /> 21 21 <label for="ch_offline"><xsl:value-of select="$lang2"/></label> 22 22 </fieldset> … … 29 29 </fieldset> 30 30 <br /> 31 <!-- 31 32 <fieldset> 32 33 <legend> <xsl:value-of select="$lang6" /> : </legend> … … 35 36 <input id="rd_ch" type="radio" name="rd_aviso" /> <label for="rd_ch"><xsl:value-of select="$lang8" /></label> 36 37 </fieldset> 38 --> 37 39 </div> 38 40 <br/>
Note: See TracChangeset
for help on using the changeset viewer.