"CHAT/MDL-14949, remove mod/chat:talk capability and check chat and readlog capabilities respectively, merged and modified from 1.9"

This commit is contained in:
dongsheng 2009-03-11 02:34:20 +00:00
parent 5e4d7ba133
commit c19df282a6
4 changed files with 37 additions and 47 deletions

View File

@ -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';

View File

@ -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',

View File

@ -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)?

View File

@ -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 '<p>';
link_to_popup_window ($chattarget,
"chat$course->id$chat->id$groupparam", "$strenterchat", 500, 700, get_string('modulename', 'chat'));
echo '</p>';
if ($CFG->enableajax) {
echo '<p>';
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 '</p>';
if ($CFG->enableajax) {
echo '<p>';
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 '</p>';
}
// 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 '<p>(';
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 ')</p>';
}
print_box_end();
} else {
print_box_start('generalbox', 'notallowenter');
echo '<p>'.get_string('notallowenter', 'chat').'</p>';
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 '<p>(';
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 ')</p>';
}
print_box_end();
if ($chat->chattime and $chat->schedule) { // A chat is scheduled
echo "<p class=\"nextchatsession\">$strnextsession: ".userdate($chat->chattime).' ('.usertimezone($USER->timezone).')</p>';
} else {