]> git.mjollnir.org Git - moodle.git/commitdiff
"CHAT/MDL-14949, remove mod/chat:talk capability and check chat and readlog capabilit...
authordongsheng <dongsheng>
Wed, 11 Mar 2009 02:34:20 +0000 (02:34 +0000)
committerdongsheng <dongsheng>
Wed, 11 Mar 2009 02:34:20 +0000 (02:34 +0000)
lang/en_utf8/chat.php
mod/chat/db/access.php
mod/chat/version.php
mod/chat/view.php

index 31931a5f1fe6d40921b3c83d6410c54d1cea5166..f80b8d4cca075aa947d4409123cdc54c41beeb0f 100644 (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';
index bfe71e4d94ab71b2233040b5dafda4b007ed0eca..f34243f41ec9c8cc1b14f3873aeec1edfc6d0434 100644 (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',
index 4a38fe6f63009f97f295b12049b9d2fc5cf06a35..f9dc159af11291a7d64009074b1b6ae3732f0a33 100644 (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)?
 
index 60944b7eed9175f15ade9d014d2b6a30f03acb6e..793492625aaf41e2b2a08557e54a422394667d8a 100644 (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);
 
                 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";
-                }
-
-                echo '<p>';
-                link_to_popup_window ($chattarget,
-                        "chat$course->id$chat->id$groupparam", "$strenterchat", 500, 700, get_string('modulename', 'chat'));
-                echo '</p>';
+                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"; 
+                    }
 
-                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 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
+                    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>';
+                    }
 
-                    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>';
-                }
+                    // 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();
+                    print_box_end();
 
+                } else {
+                    print_box_start('generalbox', 'notallowenter');
+                    echo '<p>'.get_string('notallowenter', 'chat').'</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>';