]> git.mjollnir.org Git - moodle.git/commitdiff
Messaging can now be completely disabled using $CFG->messaging
authormoodler <moodler>
Mon, 31 Jan 2005 07:11:42 +0000 (07:11 +0000)
committermoodler <moodler>
Mon, 31 Jan 2005 07:11:42 +0000 (07:11 +0000)
admin/config.html
blocks/messages/block_messages.php
blocks/online_users/block_online_users.php
lang/en/moodle.php
lib/defaults.php
lib/weblib.php
message/history.php
message/index.php
message/user.php
user/view.php

index e11e41b75952a5648f352f812923df2328e0ca28..ed8449a0adfc1f2f5a070c03fada37fb455c1ff7 100644 (file)
     </td>
 </tr>
 
+<tr valign="top">
+    <td align="right">messaging:</td>
+    <td>
+    <?php
+       unset($options);
+       $options[0] = get_string("no");
+       $options[1] = get_string("yes");
+
+       choose_from_menu ($options, "messaging", $config->messaging, "", "", "");
+    ?>
+    </td>
+    <td>
+    <?php print_string("configmessaging") ?>
+    </td>
+</tr>
+
 <tr>
     <td colspan="3" align="center">
     <input type="hidden" name="sesskey" value="<?php p($sesskey) ?>" />
index fdd409d2649bb9ef53d00f2c7a4a7ab7222a4f7b..f5e1d24968e7c7a70b5608d9555c9cc3f71043a0 100644 (file)
@@ -18,7 +18,7 @@ class block_messages extends block_base {
         $this->content->text = '';
         $this->content->footer = '';
         
-        if (empty($this->instance) or empty($USER->id) or isguest()) {
+        if (empty($this->instance) or empty($USER->id) or isguest() or empty($CFG->messaging)) {
             return $this->content;
         }
 
index 5f75eb53bb8b0f866cda548b83d2ca697c3bc004..9bb492e1acc443c0e453fc30ed8be0c8cebe88d4 100644 (file)
@@ -117,7 +117,7 @@ class block_online_users extends block_base {
                     $this->content->text .= '<img src="'.$CFG->pixpath.'/i/user.gif" style="height: 16px; width:16px; vertical-align: middle;" alt="" /> ';
                 }
                 $this->content->text .= '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$this->instance->pageid.'" title="'.$timeago.'">'.$user->fullname.'</a>';
-                if (!empty($USER->id)) {  // Only when logged in
+                if (!empty($USER->id) and ($USER->id != $user->id) and !empty($CFG->messaging)) {  // Only when logged in
                     $this->content->text .= '&nbsp;<a target="message_'.$user->id.'" href="'.$CFG->wwwroot.'/message/user.php?id='.$user->id.'" onclick="return openpopup(\'/message/user.php?id='.$user->id.'\', \'message_'.$user->id.'\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);"><img height="11" width="11" src="'.$CFG->pixpath.'/t/message.gif"></a>';
                 }
                 $this->content->text .= '</div>';
index 0ce7bd41a6c3b55d61439d5177956f41524e6811..59985c49ce85e3fb772e2534b559bd0658e6aca6 100644 (file)
@@ -203,6 +203,7 @@ $string['configloglifetime'] = 'This specifies the length of time you want to ke
 $string['configlongtimenosee'] = 'If students haven\'t logged in for a very long time, then they are automatically unsubscribed from courses.  This parameter specifies that time limit.';
 $string['configmaxbytes'] = 'This specifies a maximum size that uploaded files can be throughout the whole site.  This setting is limited by the PHP setting upload_max_filesize and the Apache setting LimitRequestBody.  In turn, maxbytes limits the range of sizes that can be chosen at course level or module level.';
 $string['configmaxeditingtime'] = 'This specifies the amount of time people have to re-edit forum postings, journal feedback etc.  Usually 30 minutes is a good value.';
+$string['configmessaging'] = 'Should the messaging system between site users be enabled?';
 $string['confignoreplyaddress'] = 'Emails are sometimes sent out on behalf of a user (eg forum posts). The email address you specify here will be used as the \"From\" address in those cases when the recipients should not be able to reply directly to the user (eg when a user chooses to keep their address private).';
 $string['confignotifyloginfailures'] = 'If login failures have been recorded, email notifications can be sent out.  Who should see these notifications?';
 $string['confignotifyloginthreshold'] = 'If notifications about failed logins are active, how many failed login attempts by one user or one IP address is it worth notifying about?';
index ac7c2a14d1da64e41e55d5ad98e690809a8e75e0..358d60507ee1782fa0b33c61f00451162f09f970 100644 (file)
@@ -45,6 +45,7 @@
        'longtimenosee'            =>  100,
        'maxbytes'                 =>  0,
        'maxeditingtime'           =>  1800,
+       'messaging'                =>  true,
        'noreplyaddress'           => 'noreply@'.$_SERVER['HTTP_HOST'],
        'notifyloginfailures'      => '',
        'notifyloginthreshold'     =>  10,
index afae6a39fce94044a09a51fb5e4ed9f445abc3c4..dddc142a88f0f68f0dc2013379664a66fe6e7635 100644 (file)
@@ -1655,7 +1655,9 @@ function print_header ($title='', $heading='', $navigation='', $focus='', $meta=
 
     include ($CFG->dirroot .'/theme/'. $CFG->theme .'/header.html');
 
-    echo message_popup_window();
+    if (!empty($CFG->messaging)) {
+        echo message_popup_window();
+    }
 }
 
 /**
index 0f7782493f93701a233e64b77a8940e35588b0bd..bff3c9b911444152089c4b6cefcb20c1a4a9dc9a 100644 (file)
@@ -6,6 +6,10 @@
 
     require_login();
 
+    if (empty($CFG->messaging)) {
+        error("Messaging is disabled on this site");
+    }
+
 /// Script parameters
     $userid1 = required_param('user1', PARAM_INT);
     if (! $user1 = get_record("user", "id", $userid1)) {  // Check it's correct
index d9ec3d4a21e7ed0998deda6c6a0f722ab1ea5c43..807b8994daa61bf1a79a45b990e07269c81d7999 100644 (file)
@@ -6,6 +6,10 @@
 
     require_login(0, false);
 
+    if (empty($CFG->messaging)) {
+        error("Messaging is disabled on this site");
+    }
+
 /// Optional variables that may be passed in
     $tab            = optional_param('tab', 'contacts'); // current tab - default to contacts
     $addcontact     = optional_param('addcontact',     0, PARAM_INT); // adding a contact
index b0a515fcb850c72271cdb59bced626cfbfccceb4..0371b23c7992806672327700e7d6d947c905f961 100644 (file)
@@ -5,6 +5,10 @@
 
     require_login();
 
+    if (empty($CFG->messaging)) {
+        error("Messaging is disabled on this site");
+    }
+
 /// Script parameters
     $userid = required_param('id', PARAM_INT);
     $frame  = optional_param('frame', '', PARAM_ALPHA);
index 4b8e5c74a5670260a794b62cebf5e0f3dcacf936..36f79ccba5cafb537e0710e223f8db76d364e951 100644 (file)
         echo "<input type=\"submit\" value=\"".get_string("loginas")."\" />";
         echo "</form></td>";
     }
-    if ($USER->id == $user->id) {
-        if ($countmessages = count_records('message', 'useridto', $user->id)) {
-            $messagebuttonname = get_string("messages", "message")."($countmessages)";
+    if (!empty($CFG->messaging)) {
+        if ($USER->id == $user->id) {
+            if ($countmessages = count_records('message', 'useridto', $user->id)) {
+                $messagebuttonname = get_string("messages", "message")."($countmessages)";
+            } else {
+                $messagebuttonname = get_string("messages", "message");
+            }
+            echo "<td nowrap=\"nowrap\"><form target=\"message\" action=\"../message/index.php\" method=\"get\">";
+            echo "<input type=\"submit\" value=\"$messagebuttonname\" onclick=\"return openpopup('/message/index.php', 'message', 'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500', 0);\" />";
+            echo "</form></td>";
         } else {
-            $messagebuttonname = get_string("messages", "message");
+            echo "<td nowrap=\"nowrap\"><form target=\"message_$user->id\" action=\"../message/user.php\" method=\"get\">";
+            echo "<input type=\"hidden\" name=\"id\" value=\"$user->id\" />";
+            echo "<input type=\"submit\" value=\"".get_string("sendmessage", "message")."\" onclick=\"return openpopup('/message/user.php?id=$user->id', 'message_$user->id', 'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500', 0);\" />";
+            echo "</form></td>";
         }
-        echo "<td nowrap=\"nowrap\"><form target=\"message\" action=\"../message/index.php\" method=\"get\">";
-        echo "<input type=\"submit\" value=\"$messagebuttonname\" onclick=\"return openpopup('/message/index.php', 'message', 'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500', 0);\" />";
-        echo "</form></td>";
-    } else {
-        echo "<td nowrap=\"nowrap\"><form target=\"message_$user->id\" action=\"../message/user.php\" method=\"get\">";
-        echo "<input type=\"hidden\" name=\"id\" value=\"$user->id\" />";
-        echo "<input type=\"submit\" value=\"".get_string("sendmessage", "message")."\" onclick=\"return openpopup('/message/user.php?id=$user->id', 'message_$user->id', 'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500', 0);\" />";
-        echo "</form></td>";
     }
     echo "<td></td>";
     echo "</tr></table></center>\n";