[Phpfreechat-svn] SF.net SVN: phpfreechat: [1068] trunk
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2007-08-01 14:06:39
|
Revision: 1068 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1068&view=rev Author: kerphi Date: 2007-08-01 07:06:37 -0700 (Wed, 01 Aug 2007) Log Message: ----------- remove comet stuff because I'll work on it in a special branche Modified Paths: -------------- trunk/themes/default/chat.js.tpl.php Removed Paths: ------------- trunk/data/public/js/pfccomet.js Deleted: trunk/data/public/js/pfccomet.js =================================================================== --- trunk/data/public/js/pfccomet.js 2007-08-01 14:05:22 UTC (rev 1067) +++ trunk/data/public/js/pfccomet.js 2007-08-01 14:06:37 UTC (rev 1068) @@ -1,87 +0,0 @@ -/** - * This class is used to get data from server using a persistent connexion - * thus the clients are informed in realtime from the server changes (very usefull for a chat application) - * Usage: - * var comet = new pfcComet({'url': './cometbackend.php', 'id': 1}); - * comet.onResponse = function(req) { alert('id:'+req['id']+' response:'+req['data']); }; - * comet.onConnect = function(comet) { alert('connected'); }; - * comet.onDisconnect = function(comet) { alert('disconnected'); }; - */ -var pfcComet = Class.create(); -pfcComet.prototype = { - - url: null, - id: 0, - timeout: 5000, - - _noerror: false, - _ajax: null, - _isconnected: false, - - initialize: function(params) { - if (!params) params = {}; - if (!params['url']) alert('error: url parameter is mandatory'); - this.url = params['url']; - if (params['id']) this.id = params['id']; - if (params['timeout']) this.timeout = params['timeout']; - }, - - connect: function() - { - if (this._isconnected) return; - this._isconnected = true; - this.onConnect(this); - this.waitForData(); - }, - - disconnect: function() - { - if (!this._isconnected) return; - this._isconnected = false; - this.onDisconnect(this); - // remove the registred callbacks in order to ignore the next response - this._ajax.options.onSuccess = null; - this._ajax.options.onComplete = null; - }, - - waitForData: function() - { - if (!this._isconnected) return; - - this._ajax = new Ajax.Request(this.url, { - method: 'get', - parameters: { 'id' : this.id }, - onSuccess: function(transport) { - // handle the server response - var response = transport.responseText.evalJSON(); - this.comet.id = response['id']; - this.comet.onResponse(response); - this.comet._noerror = true; - }, - onComplete: function(transport) { - // send a new ajax request when this request is finished - if (!this.comet._noerror) - // if a connection problem occurs, try to reconnect periodicaly - setTimeout(function(){ this.comet.waitForData(); }.bind(this), this.comet.timeout); - else - // of wait for the next data - this.comet.waitForData(); - this.comet._noerror = false; - } - }); - this._ajax.comet = this; - }, - - /** - * User's callbacks - */ - onResponse: function(response) - { - }, - onConnect: function(comet) - { - }, - onDisconnect: function(comet) - { - }, -} Modified: trunk/themes/default/chat.js.tpl.php =================================================================== --- trunk/themes/default/chat.js.tpl.php 2007-08-01 14:05:22 UTC (rev 1067) +++ trunk/themes/default/chat.js.tpl.php 2007-08-01 14:06:37 UTC (rev 1068) @@ -128,7 +128,6 @@ <script type="text/javascript" src="<?php echo $c->data_public_url; ?>/js/pfcgui.js"></script> <script type="text/javascript" src="<?php echo $c->data_public_url; ?>/js/pfcresource.js"></script> <script type="text/javascript" src="<?php echo $c->data_public_url; ?>/js/pfcprompt.js"></script> -<script type="text/javascript" src="<?php echo $c->data_public_url; ?>/js/pfccomet.js"></script> <div id="pfc_notloading" style="width:270px;background-color:#FFF;color:#000;border:1px solid #000;text-align:center;margin:5px auto 0 auto;font-size:10px;background-image:url('http://img402.imageshack.us/img402/3766/stopcc3.gif');background-repeat:no-repeat;background-position:center center;"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |