diff --git a/lang/en_utf8/chat.php b/lang/en_utf8/chat.php index 31931a5f1fe..f80b8d4cca0 100644 --- a/lang/en_utf8/chat.php +++ b/lang/en_utf8/chat.php @@ -59,6 +59,7 @@ $string['normalkeepalive'] = 'KeepAlive'; $string['normalstream'] = 'Stream'; $string['notlogged'] = 'Not logged in!'; $string['noscheduledsession'] = 'No scheduled session'; +$string['notallowenter'] = 'You are not allow to enter the chat room.'; $string['oldping'] = 'Disconnect timeout'; $string['pastchats'] = 'Past chat sessions'; $string['refreshroom'] = 'Refresh room'; diff --git a/mod/chat/db/access.php b/mod/chat/db/access.php index bfe71e4d94a..f34243f41ec 100644 --- a/mod/chat/db/access.php +++ b/mod/chat/db/access.php @@ -47,20 +47,6 @@ $mod_chat_capabilities = array( ) ), - 'mod/chat:talk' => array( - - 'riskbitmask' => RISK_SPAM, - - 'captype' => 'write', - 'contextlevel' => CONTEXT_MODULE, - 'legacy' => array( - 'student' => CAP_ALLOW, - 'teacher' => CAP_ALLOW, - 'editingteacher' => CAP_ALLOW, - 'admin' => CAP_ALLOW - ) - ), - 'mod/chat:readlog' => array( 'captype' => 'read', diff --git a/mod/chat/version.php b/mod/chat/version.php index 4a38fe6f630..f9dc159af11 100644 --- a/mod/chat/version.php +++ b/mod/chat/version.php @@ -5,7 +5,7 @@ /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2009010600; // The (date) version of this module +$module->version = 2009031100; // The (date) version of this module $module->requires = 2007101509; // Requires this Moodle version $module->cron = 300; // How often should cron check this module (seconds)? diff --git a/mod/chat/view.php b/mod/chat/view.php index 60944b7eed9..793492625aa 100644 --- a/mod/chat/view.php +++ b/mod/chat/view.php @@ -57,8 +57,6 @@ print_footer($course); exit; - } else { - require_capability('mod/chat:chat', $context); } add_to_log($course->id, 'chat', 'view', "view.php?id=$cm->id", $chat->id, $cm->id); @@ -128,41 +126,46 @@ print_heading(format_string($chat->name)); - /// Print the main part of the page - print_box_start('generalbox', 'enterlink'); - // users with screenreader set, will only see 1 link, to the manual refresh page - // for better accessibility - if (!empty($USER->screenreader)) { - $chattarget = "/mod/chat/gui_basic/index.php?id=$chat->id$groupparam"; - } else { - $chattarget = "/mod/chat/gui_$CFG->chat_method/index.php?id=$chat->id$groupparam"; - } + if (has_capability('mod/chat:chat',$context)) { + /// Print the main part of the page + print_box_start('generalbox', 'enterlink'); + // users with screenreader set, will only see 1 link, to the manual refresh page + // for better accessibility + if (!empty($USER->screenreader)) { + $chattarget = "/mod/chat/gui_basic/index.php?id=$chat->id$groupparam"; + } else { + $chattarget = "/mod/chat/gui_$CFG->chat_method/index.php?id=$chat->id$groupparam"; + } - echo '

'; - link_to_popup_window ($chattarget, - "chat$course->id$chat->id$groupparam", "$strenterchat", 500, 700, get_string('modulename', 'chat')); - echo '

'; - - if ($CFG->enableajax) { echo '

'; - link_to_popup_window ("/mod/chat/gui_ajax/index.php?id=$chat->id$groupparam", - "chat$course->id$chat->id$groupparam", get_string('ajax_gui', 'message'), 500, 700, get_string('modulename', 'chat')); + link_to_popup_window ($chattarget, + "chat$course->id$chat->id$groupparam", "$strenterchat", 500, 700, get_string('modulename', 'chat')); echo '

'; + + if ($CFG->enableajax) { + echo '

'; + link_to_popup_window ("/mod/chat/gui_ajax/index.php?id=$chat->id$groupparam", + "chat$course->id$chat->id$groupparam", get_string('ajax_gui', 'message'), 500, 700, get_string('modulename', 'chat')); + echo '

'; + } + + // if user is using screen reader, then there is no need to display this link again + if ($CFG->chat_method == 'header_js' && empty($USER->screenreader)) { + // show frame/js-less alternative + echo '

('; + link_to_popup_window ("/mod/chat/gui_basic/index.php?id=$chat->id$groupparam", + "chat$course->id$chat->id$groupparam", get_string('noframesjs', 'message'), 500, 700, get_string('modulename', 'chat')); + echo ')

'; + } + + print_box_end(); + + } else { + print_box_start('generalbox', 'notallowenter'); + echo '

'.get_string('notallowenter', 'chat').'

'; + print_box_end(); } - // if user is using screen reader, then there is no need to display this link again - if ($CFG->chat_method == 'header_js' && empty($USER->screenreader)) { - // show frame/js-less alternative - - echo '

('; - link_to_popup_window ("/mod/chat/gui_basic/index.php?id=$chat->id$groupparam", - "chat$course->id$chat->id$groupparam", get_string('noframesjs', 'message'), 500, 700, get_string('modulename', 'chat')); - echo ')

'; - } - - print_box_end(); - - if ($chat->chattime and $chat->schedule) { // A chat is scheduled echo "

$strnextsession: ".userdate($chat->chattime).' ('.usertimezone($USER->timezone).')

'; } else {