]> git.mjollnir.org Git - moodle.git/commitdiff
COnfiguration variables can now be edited via GUI
authormoodler <moodler>
Sat, 23 Aug 2003 14:03:14 +0000 (14:03 +0000)
committermoodler <moodler>
Sat, 23 Aug 2003 14:03:14 +0000 (14:03 +0000)
lang/en/chat.php
mod/chat/config.html [new file with mode: 0644]
mod/chat/gui_header_js/jsupdate.php
mod/chat/lib.php
mod/chat/users.php

index bd5f580d2a9faa10172d653da0ba70b6e0869a85..50ccd1230a298105f5088906eacf1b74f108776f 100644 (file)
@@ -10,6 +10,9 @@ $string['chatintro'] = "Introduction text";
 $string['chatname'] = "Name of this chat room";
 $string['chatreport'] = "Chat sessions";
 $string['chattime'] = "Next chat time";
+$string['configrefreshroom'] = "How often should the chat room itself be refreshed? (in seconds).  Setting this low will make the chat room seem quicker, but it may place a higher load on your web server when many people are chatting";
+$string['configrefreshuserlist'] = "How often should the list of users be refreshed? (in seconds)";
+$string['configoldping'] = "After how long of not hearing from a user should we consider them gone?";
 $string['currentchats'] = "Active chat sessions";
 $string['currentusers'] = "Current users";
 $string['donotusechattime'] = "Don't publish any chat times";
diff --git a/mod/chat/config.html b/mod/chat/config.html
new file mode 100644 (file)
index 0000000..cafb5ae
--- /dev/null
@@ -0,0 +1,37 @@
+<form method="post" action="module.php" name="form">
+
+<table cellpadding=9 cellspacing=0 >
+<tr valign=top>
+       <td align=right><p>chat_refresh_room:</td>
+       <td>
+    <input name=chat_refresh_room type=text size=5 value="<?php p($CFG->chat_refresh_room) ?>">
+    </td>
+    <td>
+    <?php print_string("configrefreshroom", "chat") ?>
+    </td>
+</tr>
+<tr valign=top>
+       <td align=right><p>chat_refresh_userlist:</td>
+       <td>
+    <input name=chat_refresh_userlist type=text size=5 value="<?php p($CFG->chat_refresh_userlist) ?>">
+    </td>
+    <td>
+    <?php print_string("configrefreshuserlist", "chat") ?>
+    </td>
+</tr>
+<tr valign=top>
+       <td align=right><p>chat_old_ping:</td>
+       <td>
+    <input name=chat_old_ping type=text size=5 value="<?php p($CFG->chat_old_ping) ?>">
+    </td>
+    <td>
+    <?php print_string("configoldping", "chat") ?>
+    </td>
+</tr>
+<tr>
+    <td colspan=3 align=center>
+       <input type="submit" value="<?php print_string("savechanges") ?>"></td>
+</tr>
+</table>
+
+</form>
index af90a76904e2e962c9385a1355468a9d65984eb7..33e025228f7bf272bc8d9657760db79616dad33f 100644 (file)
@@ -31,7 +31,7 @@ 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=jsupdate.php?chat_sid=".$chat_sid."&chat_lasttime=".$chat_newlasttime);
+header("Refresh: $CFG->chat_refresh_room; URL=jsupdate.php?chat_sid=".$chat_sid."&chat_lasttime=".$chat_newlasttime);
 
 ?>
   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
index 2db3bb0ef093ce8994e48b39e888e35a6862d436..c5539a4551b7697f12d2524973ef80df89b00178 100644 (file)
@@ -2,10 +2,16 @@
 
 /// Library of functions and constants for module chat
 
+if (!isset($CFG->chat_refresh_room)) {
+    set_config("chat_refresh_room", 5);
+} 
+if (!isset($CFG->chat_refresh_userlist)) {
+    set_config("chat_refresh_userlist", 10);
+} 
+if (!isset($CFG->chat_old_ping)) {
+    set_config("chat_old_ping", 30);
+} 
 
-define("CHAT_REFRESH_ROOM", 10);
-define("CHAT_REFRESH_USERLIST", 10);
-define("CHAT_OLD_PING", 30);
 
 define("CHAT_DRAWBOARD", false);  // Look into this later
 
@@ -217,7 +223,9 @@ function chat_login_user($chatid, $version="header_js") {
 function chat_delete_old_users() {
 // Delete the old and in the way
 
-    $timeold = time() - CHAT_OLD_PING;
+    global $CFG;
+
+    $timeold = time() - $CFG->chat_old_ping;
 
     if ($oldusers = get_records_select("chat_users", "lastping < '$timeold'") ) {
         delete_records_select("chat_users", "lastping < '$timeold'");
index fb95c0ed5a06a3cd910bd9538bc105960428d903..14cff4c7e9d4c52a381eb4a3277187ae1c945f0c 100644 (file)
@@ -61,7 +61,7 @@ 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: ".CHAT_REFRESH_USERLIST."; URL=users.php?chat_sid=$chat_sid");
+header("Refresh: $CFG->chat_refresh_userlist; URL=users.php?chat_sid=$chat_sid");
 
 print_header();