forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Very early version of new chat module, made by Martin using ARSC as
an inspiration. Works OK already on most newish browsers .. see mod/chat/README.txt for details.
- Loading branch information
moodler
committed
Jul 7, 2003
1 parent
96e1bd4
commit 1515a89
Showing
31 changed files
with
2,124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?PHP // $Id$ | ||
|
||
#------------------------------------------------------------ | ||
$string['modulename'] = "Chat"; | ||
$string['modulenameplural'] = "Chats"; | ||
#------------------------------------------------------------ | ||
|
||
$string['chatintro'] = "Introduction text"; | ||
$string['chatname'] = "Name of this chat room"; | ||
$string['enterchat'] = "Click here to enter the chat"; | ||
$string['messageenter'] = "\$a has just entered this chat"; | ||
$string['savemessages'] = "Number of messages to save"; | ||
$string['strftimemessage'] = "%%H:%%M"; | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Official Chat Module for Moodle | ||
------------------------------ | ||
|
||
Version 0.1 (for Moodle 1.1) | ||
|
||
This module is still very new and very incomplete compared | ||
to the version that will be shipping with Moodle 1.1 | ||
|
||
It's based in part on ARSC but I ended up rewriting so much | ||
of it there's hardly a line of code in use that has not | ||
been changed, so perhaps it's *inspired* by ARSC. | ||
|
||
It's fairly useful already and should work with most newer browers. | ||
|
||
Note it supports user images, smilies and even HTML already. | ||
|
||
Things to do yet: | ||
|
||
- fix up the other chat front-end version (currently only using | ||
header_js) | ||
|
||
- make the socket server work | ||
|
||
- more useful shortcuts in the user interface | ||
|
||
- postgresql support (db schema) | ||
|
||
|
||
Martin, 7 July 2003 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?PHP // $Id$ | ||
|
||
function chat_upgrade($oldversion) { | ||
// This function does anything necessary to upgrade | ||
// older versions to match current functionality | ||
|
||
global $CFG; | ||
|
||
if ($oldversion < 2002080500) { | ||
} | ||
|
||
return true; | ||
} | ||
|
||
|
||
?> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# | ||
# Table structure for table `chat` | ||
# | ||
|
||
CREATE TABLE `prefix_chat` ( | ||
`id` int(10) unsigned NOT NULL auto_increment, | ||
`course` int(10) unsigned NOT NULL default '0', | ||
`name` varchar(255) NOT NULL default '', | ||
`intro` text NOT NULL, | ||
`messages` int(11) NOT NULL default '1000', | ||
`timemodified` int(10) unsigned NOT NULL default '0', | ||
PRIMARY KEY (`id`) | ||
) TYPE=MyISAM COMMENT='Each of these is a chat room'; | ||
# -------------------------------------------------------- | ||
|
||
# | ||
# Table structure for table `chat_messages` | ||
# | ||
|
||
CREATE TABLE `prefix_chat_messages` ( | ||
`id` int(10) unsigned NOT NULL auto_increment, | ||
`chatid` int(10) NOT NULL default '0', | ||
`userid` int(10) NOT NULL default '0', | ||
`system` int(1) unsigned NOT NULL default '0', | ||
`message` text NOT NULL, | ||
`timestamp` int(10) NOT NULL default '0', | ||
PRIMARY KEY (`id`), | ||
KEY `timemodifiedchat` (`timestamp`,`chatid`) | ||
) TYPE=MyISAM COMMENT='Stores all the actual chat messages'; | ||
# -------------------------------------------------------- | ||
|
||
# | ||
# Table structure for table `chat_users` | ||
# | ||
|
||
CREATE TABLE `prefix_chat_users` ( | ||
`id` int(10) unsigned NOT NULL auto_increment, | ||
`chatid` int(11) NOT NULL default '0', | ||
`userid` int(11) NOT NULL default '0', | ||
`version` varchar(16) NOT NULL default '', | ||
`ip` varchar(15) NOT NULL default '', | ||
`firstping` int(10) unsigned NOT NULL default '0', | ||
`lastping` int(10) unsigned NOT NULL default '0', | ||
`lastmessageping` int(10) unsigned NOT NULL default '0', | ||
`sid` varchar(32) NOT NULL default '', | ||
PRIMARY KEY (`id`), | ||
KEY `userid` (`userid`), | ||
KEY `lastping` (`lastping`) | ||
) TYPE=MyISAM COMMENT='Keeps track of which users are in which chat rooms'; | ||
|
||
|
||
INSERT INTO prefix_log_display VALUES ('chat', 'view', 'chat', 'name'); | ||
INSERT INTO prefix_log_display VALUES ('chat', 'add', 'chat', 'name'); | ||
INSERT INTO prefix_log_display VALUES ('chat', 'update', 'chat', 'name'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
include("../config.inc.php"); | ||
include("../functions.inc.php"); | ||
|
||
$arsc_result = mysql_query("SELECT COUNT(*) AS anzahl FROM arsc_users WHERE sid = '$arsc_sid'"); | ||
$arsc_a = mysql_fetch_array($arsc_result); | ||
if ($arsc_a["anzahl"] == 1) | ||
{ | ||
?> | ||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> | ||
<html> | ||
<head> | ||
<title> | ||
Abacho - Drawboard | ||
</title> | ||
</head> | ||
<body bgcolor="#000000" topmargin="0" leftmargin="0" marginleft="0" margintop="0"> | ||
<APPLET CODE="drawboard/Main.class" WIDTH="<?php echo $arsc_parameters["drawboard_width"]; ?>" HEIGHT="<?php echo $arsc_parameters["drawboard_height"]; ?>"> | ||
<param name="port" value="<?php echo $arsc_parameters["drawboard_port"]; ?>"> | ||
<param name="bgcolor" value="FFFFFF"> | ||
<PARAM NAME="menubgcolor" VALUE="FAE6A6"> | ||
<PARAM NAME="emptythumbnailcolor" VALUE="FDF0C6"> | ||
<PARAM NAME="countercolor" VALUE="000000"> | ||
<param name="pencolor" value="0000FF"> | ||
<PARAM NAME="skindef" VALUE="abacho/abacho.def"> | ||
Unfortunatelly, your browser doesn't support Java applets. You have to use another one. | ||
</APPLET> | ||
</body> | ||
</html> | ||
<?php | ||
} | ||
else | ||
{ | ||
header("Location: ../shared/empty.php"); | ||
die(); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> | ||
<html> | ||
<head> | ||
<title> | ||
</title> | ||
</head> | ||
<body bgcolor="#FFFFFF"> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
include("../config.inc.php"); | ||
include("../functions.inc.php"); | ||
|
||
if ($arsc_my = arsc_getdatafromsid($arsc_sid)) | ||
{ | ||
include("../shared/language/".$arsc_my["language"].".inc.php"); | ||
|
||
if ($arsc_my["level"] >= 0) | ||
{ | ||
echo $arsc_parameters["htmlhead_msginput"]; | ||
?> | ||
<form action="../shared/chatins.php" METHOD="POST" name="f"> | ||
<input type="hidden" name="arsc_sid" value="<?php echo $arsc_sid; ?>"> | ||
<input type="hidden" name="arsc_chatversion" value="header"> | ||
<input type="text" name="arsc_message" size="50" maxlength="<?php echo $arsc_parameters["input_maxsize"]; ?>" value="<?php echo $arsc_pretext; ?>"> | ||
<input type="submit" value="<?php echo $arsc_lang["sendmessage"]; ?>"> | ||
</form> | ||
</body> | ||
</html> | ||
<?php | ||
} | ||
else | ||
{ | ||
echo $arsc_parameters["htmlhead_out"]; | ||
} | ||
} | ||
else | ||
{ | ||
echo $arsc_parameters["htmlhead_out"]; | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
include("../config.inc.php"); | ||
include("../functions.inc.php"); | ||
include("../filter.inc.php"); | ||
|
||
if ($arsc_my = arsc_getdatafromsid($arsc_sid)) | ||
{ | ||
include("../shared/language/".$arsc_my["language"].".inc.php"); | ||
|
||
$arsc_user = $arsc_my["user"]; | ||
$arsc_room = $arsc_my["room"]; | ||
if ($arsc_lastid == "") | ||
{ | ||
$arsc_result = mysql_query("SELECT * from arsc_room_$arsc_room ORDER BY timeid DESC"); | ||
$arsc_b = mysql_fetch_array($arsc_result); | ||
$arsc_lastid = $arsc_b["timeid"]; | ||
} | ||
|
||
if ($arsc_my["level"] < 0) | ||
{ | ||
switch($arsc_my["level"]) | ||
{ | ||
case "-1": $arsc_message = $arsc_lang["youwerekicked"]; | ||
mysql_query("DELETE from arsc_users WHERE sid = '$arsc_sid'"); | ||
break; | ||
} | ||
header("Expires: Sun, 28 Dec 1997 09:32:45 GMT"); | ||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); | ||
header("Cache-Control: no-cache, must-revalidate"); | ||
header("Pragma: no-cache"); | ||
header("Content-Type: text/html"); | ||
echo $arsc_parameters["htmlhead"]; | ||
echo arsc_filter_posting("System", date("H:i:s"), "<font size=\"4\"><b>".$arsc_message."</b></font>", $arsc_room, 0); | ||
?> | ||
</body> | ||
</html> | ||
<?php | ||
} | ||
else | ||
{ | ||
header("Expires: Sun, 28 Dec 1997 09:32:45 GMT"); | ||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); | ||
header("Cache-Control: no-cache, must-revalidate"); | ||
header("Pragma: no-cache"); | ||
header("Content-Type: text/html"); | ||
header("Refresh: 4; URL=chatmsg.php?arsc_sid=".$arsc_sid."&arsc_lastid=".$arsc_lastid."&dummy=".time()."#end"); | ||
echo $arsc_parameters["htmlhead"]; | ||
|
||
set_magic_quotes_runtime(0); | ||
$arsc_sendtime = date("H:i:s"); | ||
$arsc_timeid = arsc_microtime(); | ||
$arsc_message = "/msg ".$arsc_my["user"]." ".$arsc_lang["welcome"]; | ||
echo arsc_filter_posting("System", $arsc_sendtime, $arsc_message, $arsc_room, 0); | ||
$arsc_result = mysql_query("SELECT * FROM arsc_room_$arsc_room WHERE timeid > '$arsc_lastid' ORDER BY timeid ASC"); | ||
while ($arsc_a = mysql_fetch_array($arsc_result)) | ||
{ | ||
echo arsc_filter_posting($arsc_a["user"], $arsc_a["sendtime"], $arsc_a["message"], $arsc_room, $arsc_a["flag_ripped"])."\n"; | ||
} | ||
$arsc_ping = time(); | ||
$arsc_ip = getenv("REMOTE_ADDR"); | ||
mysql_query("UPDATE arsc_users SET lastping = '$arsc_ping', ip = '$arsc_ip' WHERE user = '$arsc_user'"); | ||
?> | ||
<a name="end"></a> | ||
</body> | ||
</html> | ||
<?php | ||
} | ||
} | ||
else | ||
{ | ||
echo $arsc_parameters["htmlhead_out"]; | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
include("../config.inc.php"); | ||
include("../functions.inc.php"); | ||
?> | ||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> | ||
<html> | ||
<head> | ||
<title> | ||
ARSC - ARSC Really Simple Chat | ||
</title> | ||
</head> | ||
<frameset cols="193,*,120" border="0" framespacing="no" frameborder="0" marginwidth="2" marginheight="1"> | ||
<frame src="../shared/roomlist.php?arsc_sid=<?php echo $arsc_sid; ?>" name="roomlist" scrolling="auto" noresize marginwidth="0" marginheight="0"> | ||
<frameset rows="*,40" border="1" framespacing="no" frameborder="0" marginwidth="2" marginheight="1"> | ||
<frame src="chatmsg.php?arsc_sid=<?php echo $arsc_sid; ?>#end" NAME="msg" scrolling="auto" noresize marginwidth="2" marginheight="1"> | ||
<frame src="chatinput.php?arsc_sid=<?php echo $arsc_sid; ?>" name="input" scrolling="no" noresize marginwidth="2" marginheight="1"> | ||
</frameset> | ||
<frame src="../shared/userlist.php?arsc_sid=<?php echo $arsc_sid; ?>&arsc_enter=true" name="users" scrolling="auto" noresize marginwidth="5" marginheight="5"> | ||
</frameset> | ||
<noframes> | ||
Sorry, this version of ARSC needs a browser that understands framesets. We have a Lynx friendly version too. | ||
</noframes> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
require("../../../config.php"); | ||
require("../lib.php"); | ||
|
||
if (!$chatuser = get_record("chat_users", "sid", $chat_sid)) { | ||
echo "Not logged in!"; | ||
} | ||
|
||
?> | ||
|
||
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\"> | ||
<html> | ||
<head> | ||
<title>Message Input</title> | ||
<script language="Javascript"> | ||
<!-- | ||
scroll_active = true; | ||
function empty_field_and_submit() { | ||
document.fdummy.chat_message.value=document.f.chat_message.value; | ||
document.fdummy.submit(); | ||
document.f.chat_message.value=''; | ||
document.f.chat_message.focus(); | ||
return false; | ||
} | ||
// --> | ||
</script> | ||
</head> | ||
|
||
<body bgcolor="<?php echo $THEME->body ?>" | ||
OnLoad="document.f.chat_message.focus();document.f.chat_message.select();"> | ||
|
||
|
||
<form action="../insert.php" method="GET" target="empty" name="f" | ||
OnSubmit="return empty_field_and_submit()"> | ||
>><input type="text" name="chat_message" size="60" value="<?php echo $chat_pretext; ?>"> | ||
</form> | ||
|
||
<form action="../insert.php" method="GET" target="empty" name="fdummy" | ||
OnSubmit="return empty_field_and_submit()"> | ||
<input type="hidden" name="chat_sid" value="<?php echo $chat_sid; ?>"> | ||
<input type="hidden" name="chat_version" value="header_js"> | ||
<input type="hidden" name="chat_message"> | ||
</form> | ||
|
||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<html> | ||
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
require_once('../../../config.php'); | ||
require_once('../lib.php'); | ||
|
||
require_variable($id); | ||
|
||
if (!$chat = get_record("chat", "id", $id)) { | ||
error("Could not find that chat room!"); | ||
} | ||
|
||
if (!$course = get_record("course", "id", $chat->course)) { | ||
error("Could not find the course this belongs to!"); | ||
} | ||
|
||
if (!$chat_sid = chat_login_user($chat->id, "header_js")) { | ||
error("Could not log in to chat room!!"); | ||
} | ||
|
||
$strchat = get_string("modulename", "chat"); | ||
|
||
|
||
?> | ||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> | ||
<html> | ||
<head> | ||
<title> | ||
<?php echo "$strchat: $course->shortname: $chat->name" ?> | ||
</title> | ||
</head> | ||
<frameset cols="*,200" border="4" framespacing="no" frameborder="yes" marginwidth="2" marginheight="1"> | ||
<frameset rows="1,1,*,40" border="0" framespacing="no" frameborder="no" marginwidth="2" marginheight="1"> | ||
<frame src="../empty.php" NAME="empty" scrolling="no" marginwidth="0" marginheight="0"> | ||
<frame src="jsupdate.php?chat_sid=<?php echo $chat_sid; ?>&chat_enter=true" scrolling="no" marginwidth="0" marginheight="0"> | ||
<frame src="chatmsg.php" NAME="msg" scrolling="auto" marginwidth="2" marginheight="1"> | ||
<frame src="chatinput.php?chat_sid=<?php echo $chat_sid; ?>" name="input" scrolling="no" marginwidth="2" marginheight="1"> | ||
</frameset> | ||
<frame src="../users.php?chat_sid=<?php echo $chat_sid; ?>&chat_enter=true" name="users" scrolling="auto" marginwidth="5" marginheight="5"> | ||
</frameset> | ||
<noframes> | ||
Sorry, this version of ARSC needs a browser that understands framesets. We have a Lynx friendly version too. | ||
</noframes> | ||
</html> |
Oops, something went wrong.