From: moodler Date: Sat, 23 Aug 2003 14:03:14 +0000 (+0000) Subject: COnfiguration variables can now be edited via GUI X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=b5012f3eb5d0e285e7a9fccb33788d130e070dc4;p=moodle.git COnfiguration variables can now be edited via GUI --- diff --git a/lang/en/chat.php b/lang/en/chat.php index bd5f580d2a..50ccd1230a 100644 --- a/lang/en/chat.php +++ b/lang/en/chat.php @@ -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 index 0000000000..cafb5aed71 --- /dev/null +++ b/mod/chat/config.html @@ -0,0 +1,37 @@ +
+ + + + + + + + + + + + + + + + + + + + +

chat_refresh_room:

+ + + +

chat_refresh_userlist:

+ + + +

chat_old_ping:

+ + + +
+ ">
+ +
diff --git a/mod/chat/gui_header_js/jsupdate.php b/mod/chat/gui_header_js/jsupdate.php index af90a76904..33e025228f 100644 --- a/mod/chat/gui_header_js/jsupdate.php +++ b/mod/chat/gui_header_js/jsupdate.php @@ -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); ?> diff --git a/mod/chat/lib.php b/mod/chat/lib.php index 2db3bb0ef0..c5539a4551 100644 --- a/mod/chat/lib.php +++ b/mod/chat/lib.php @@ -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'"); diff --git a/mod/chat/users.php b/mod/chat/users.php index fb95c0ed5a..14cff4c7e9 100644 --- a/mod/chat/users.php +++ b/mod/chat/users.php @@ -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();