Closed (fixed)
Project:
Chatblock
Version:
5.x-1.0.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
15 May 2007 at 09:40 UTC
Updated:
4 Dec 2007 at 08:51 UTC
Messages could be sent through AJAX, but they're showed only after page refresh. I have tried this on Linux/Firefox 2, Windows/Firefox 2, Windows/IE 6.
As far as I can see the setInterval instruction at the end of chatblock.js is not working because
Also, JS functions of jQuery are not reachable (out of scope?) in the iframe that is used to show the messages.
There were some typos in the filenames of the smileys.
Here are the patches:
--- chatblock.module 2007-05-15 11:18:55.000000000 +0200
+++ chatblock.original/chatblock.module 2007-05-08 20:56:02.000000000 +0200
@@ -280,13 +280,11 @@
$output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
$output .= "<head>\n";
$output .= "<title>Chatbox Iframe<title>\n";
- $output .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . $url . '/css/chatblock.css' . "\" />\n";
- $output .= "<script type=\"text/javascript\" src=\"" . $url . '/chatblock.js' . "\"></script>\n";
- $output .= "<script type=\"text/javascript\" src=\"" . base_path() . 'misc/jquery.js' . "\"></script>\n";
+ $output .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . url($url . '/css/chatblock.css') . "\" />\n";
+ $output .= "<script type=\"text/javascript\" src=\"" . url($url . '/chatblock.js') . "\"></script>\n";
$output .= "<script type=\"text/javascript\">\n";
$output .= "chatblock.url = '". url('chatblock/view') . "';\n";
- $output .= "chatblock.rate = ". $rate . ";\n";
- $output .= "setInterval(chatboxGetMessage, chatblock.rate);\n";
+ $output .= "chatblock.rate = ". $rate . ";\n";
$output .= "</script>\n";
$output .= "</head>\n";
$output .= "<body style=\"width:180px; background-color: white;\" onload=\"chatboxInitScroll();\">\n";
@@ -321,14 +319,14 @@
* This function filters the messages and adds the smileys and extra if any.
*/
function chatblock_filter_message($message) {
- $url = drupal_get_path('module', 'chatblock');
+ $url = '/' . drupal_get_path('module', 'chatblock');
$message = strip_tags($message);
- $message = preg_replace("/>\:>/" , '<img src="'.$url.'/images/twisted.gif" alt=":twisted:" />', $message);
- $message = preg_replace("/\?\:\)/" , '<img src="'.$url.'/images/think.gif" alt=":think:" />', $message);
+ $message = preg_replace("/>\:>/" , '<img src="'.$url.'/images wisted.gif" alt=":twisted:" />', $message);
+ $message = preg_replace("/\?\:\)/" , '<img src="'.$url.'/images hink.gif" alt=":think:" />', $message);
$message = preg_replace("/N\:\)/" , '<img src="'.$url.'/images/naughty.gif" alt=":naughty:" />', $message);
$message = preg_replace("/O\:\)/" , '<img src="'.$url.'/images/angel.gif" alt=":angel:" />', $message);
$message = preg_replace("/\:D/" , '<img src="'.$url.'/images/biggrin.gif" alt=":biggrin:" />', $message);
- $message = preg_replace("/\:P/" , '<img src="'.$url.'/images/tongue.gif" alt=":tongue:" />', $message);
+ $message = preg_replace("/\:P/" , '<img src="'.$url.'/images ongue.gif" alt=":tongue:" />', $message);
$message = preg_replace("/\:o/" , '<img src="'.$url.'/images/impressed.gif" alt=":impressed:" />', $message);
$message = preg_replace("/\:\|/" , '<img src="'.$url.'/images/neutral.gif" alt=":neutral:" />', $message);
$message = preg_replace("/8-\)/" , '<img src="'.$url.'/images/cool.gif" alt=":cool:" />', $message);
And for the chatblock.js:
--- chatblock.js 2007-05-15 11:03:32.000000000 +0200
+++ chatblock.original/chatblock.js 2007-05-08 20:56:02.000000000 +0200
@@ -14,7 +14,7 @@
}
}
-var chatblock = new Object();
+var chatblock;
/**
* Creates an HTTP POST request and sends the response to the callback function
@@ -80,4 +80,4 @@
return;
}
-// chatBlockInterval = window.setInterval(chatboxGetMessage, chatblock.rate);
\ No newline at end of file
+chatBlockInterval = window.setInterval(chatboxGetMessage, $rate);
\ No newline at end of file
Use Firebug!
Comments
Comment #1
dwees commentedI do actually use Firebug but it seems to have some issues with displaying errors from my domain. Not sure totally why, I've tried changing all the settings I can. It shows errors on my local machine just fine.
I'll try out these patches and see if they fix these problems, thank you.
Dave
Comment #2
dwees commentedActually I deliberated copied the functions out of the old drupal.js because I noticed IE was having problems with the double inclusion of jQuery.js on the same page (it seems to me that IE can't handled two different frames using the same JS functions, but maybe it was my imagination).
So I've replaced the line that does the Ajax with what I think should be the Drupal.js equivalent.
The line starting $.Ajax(blah blah... etc..) becomes instead
Also, this isn't a huge issue, but I believe you've created your patch in the opposite direction...from new to old.
Dave
Comment #3
ubul commentedI didn't know the old version. I started to use Drupal and Chatblock recently, with Drupal 5. This patch is a quick and dirty solution to make Chatblock work. But now I see that it doesn't work for IE.
JQuery claims that it is cross-platform and more importantly cross-browser compliant, and it's in the Drupal core. Wouldn't it be better if you would swap the iframe with a div? Then you could use JQuery to append new messages and IE wouldn't have a problem. I know that then the JS disabled browsers simply couldn't use the chat, but with which option would you exclude more users?
I'll try to implement the forementioned version.
Comment #4
dwees commentedThat's a good solution. It would save on page load times as well. I think the reason why I used an iframe in the first place was to make the scrolling automatic, and to eventually allow for users with JavaScript disabled to use the chat without refreshing the whole page.
Dave
Comment #5
pclux commentedso these patches are not good to go as they are here correct? after dwees testing, is there an updated patch... by the way , there are display issues in Safari just FYI. chatbox doesn't display nor does content. Works fine in Mac firefox, camino, etc.
Comment #6
nepf commentedi have the same problem: no ajax refresh.
very sad!
Comment #7
manolopm commentedStill the problem of the refresh is there... Any solution? a Patch?
Comment #8
dwees commentedComment #9
autofab commentedI just downloaded and installed the chatblock this morning. it seems like I have this same issue since the page doesn't automatically refresh. I'm sorry I didn't really understand what is the real status of this issue: has this been solved in the module version I downloaded today or does it need a patch that is still under development (there was no patch file or folder in the package)?
thank you so much, and please excuse me if I'm wrongly re-opening an already solved issue...
Comment #10
dwees commentedHi there,
Can you give me some more information so I can figure out what's going on?
What browser are you using?
What version of Php do you have?
What is your version of Drupal?
How did you test that this module is not refreshing?
Dave
Comment #11
autofab commentedhello!
I use both IExplorer 6 sp2 and FireFox 2.0.0.9
PHP Version is 4.4.7 on a Linux server Apache/2.0
Drupal version is 5.1
I simply tested by entering words and waiting for some time. nothing happens unless I manually refresh the webpage.
thanks so much for you help, but please consider I'm a simple user and I easily could have done something wrong ;)
Comment #12
dwees commentedHave you ever used this module before, and if so, did you run the database upgrade script? What version of MySQL are you using? Can you confirm that the database tables have been created correctly? The timestamp column should be 'bigint'.
Also, can you try upgrading your version of Drupal? This is a reasonably easy matter of over-writing your core Drupal files and running the update script.
Dave
Comment #13
dwees commentedJust downloaded the module and used a fresh install of Drupal and had the same problem. Apparently I forgot to change the column type for 'timestamp'. It should be 'bigint'. I'll fix this in the current version in CVS and hopefully this will be the end of the problems with this module.
Dave
Comment #14
autofab commentedwow... great news Dave!
it was indeed that timestamp issue that blocked everything. I made the change in the db and now everything runs smoothly!
thank you very much for your code and your kind support!
Comment #15
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.