Index: lang/en_utf8/role.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lang/en_utf8/role.php,v
retrieving revision 1.47.2.10
diff -u -r1.47.2.10 role.php
--- lang/en_utf8/role.php 17 Jan 2008 11:28:57 -0000 1.47.2.10
+++ lang/en_utf8/role.php 22 Feb 2008 23:39:44 -0000
@@ -176,6 +176,7 @@
// Notes
$string['notes:view'] = 'View notes';
$string['notes:manage'] = 'Manage notes';
+$string['notes:viewnotesonself'] = 'View notes written about one\'s self';
//OBSOLETED in 1.9!
$string['course:viewcoursegrades'] = 'View course grades';
Index: lib/db/access.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/db/access.php,v
retrieving revision 1.75.2.5
diff -u -r1.75.2.5 access.php
--- lib/db/access.php 18 Jan 2008 10:08:10 -0000 1.75.2.5
+++ lib/db/access.php 22 Feb 2008 23:21:49 -0000
@@ -1135,6 +1135,7 @@
),
'moodle/notes:view' => array(
+ 'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
@@ -1145,6 +1146,7 @@
),
'moodle/notes:manage' => array(
+ 'riskbitmask' => RISK_PERSONAL,
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
@@ -1154,6 +1156,18 @@
)
),
+ 'moodle/notes:viewnotesonself' => array(
+ 'captype' => 'read',
+ 'contextlevel' => CONTEXT_SYSTEM,
+ 'legacy' => array(
+ 'user' => CAP_ALLOW,
+ 'student' => CAP_ALLOW,
+ 'teacher' => CAP_ALLOW,
+ 'editingteacher' => CAP_ALLOW,
+ 'admin' => CAP_ALLOW
+ )
+ ),
+
'moodle/tag:manage' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
Index: notes/index.php
===================================================================
RCS file: /cvsroot/moodle/moodle/notes/index.php,v
retrieving revision 1.6.2.1
diff -u -r1.6.2.1 index.php
--- notes/index.php 10 Jan 2008 10:58:09 -0000 1.6.2.1
+++ notes/index.php 23 Feb 2008 00:12:38 -0000
@@ -82,14 +82,14 @@
//echo '' . $strsitenotes . ' | ' . $strcoursenotes . ' | ' . $strpersonalnotes . '';
$context = get_context_instance(CONTEXT_COURSE, $courseid);
$addid = has_capability('moodle/notes:manage', $context) ? $courseid : 0;
- $view = has_capability('moodle/notes:view', $context);
+ $view = (($USER->id == $user->id && has_capability('moodle/notes:viewnotesonself', $context)) || has_capability('moodle/notes:view', $context));
note_print_notes('' . $strsitenotes, $addid, $view, 0, $userid, NOTES_STATE_SITE, 0);
note_print_notes('' . $strcoursenotes. ' ('.$course->fullname.')', $addid, $view, $courseid, $userid, NOTES_STATE_PUBLIC, 0);
note_print_notes('' . $strpersonalnotes, $addid, $view, $courseid, $userid, NOTES_STATE_DRAFT, $USER->id);
- } else { // Normal course
+ } else { // site course
//echo '' . $strsitenotes . ' | ' . $strcoursenotes . '';
- $view = has_capability('moodle/notes:view', get_context_instance(CONTEXT_SYSTEM));
+ $view = (($USER->id == $user->id && has_capability('moodle/notes:viewnotesonself', get_context_instance(CONTEXT_SYSTEM))) || has_capability('moodle/notes:view', get_context_instance(CONTEXT_SYSTEM)));
note_print_notes('' . $strsitenotes, 0, $view, 0, $userid, NOTES_STATE_SITE, 0);
echo '';
@@ -102,6 +102,7 @@
} else {
$addid = 0;
}
+ $view = has_capability('moodle/notes:manage', get_context_instance(CONTEXT_COURSE, $c->id));
note_print_notes($header, $addid, $view, $c->id, $userid, NOTES_STATE_PUBLIC, 0);
}
}
Index: user/tabs.php
===================================================================
RCS file: /cvsroot/moodle/moodle/user/tabs.php,v
retrieving revision 1.43.2.1
diff -u -r1.43.2.1 tabs.php
--- user/tabs.php 26 Jan 2008 16:56:24 -0000 1.43.2.1
+++ user/tabs.php 22 Feb 2008 22:57:44 -0000
@@ -169,7 +169,7 @@
$toprow[] = new tabobject('blogs', $CFG->wwwroot.'/blog/index.php?userid='.$user->id.'&courseid='.$course->id, get_string('blog', 'blog'));
}
- if (has_capability('moodle/notes:manage', $coursecontext) || has_capability('moodle/notes:view', $coursecontext)) {
+ if ($USER->id == $user->id || has_capability('moodle/notes:manage', $coursecontext) || has_capability('moodle/notes:view', $coursecontext)) {
$toprow[] = new tabobject('notes', $CFG->wwwroot.'/notes/index.php?course='.$course->id . '&user=' . $user->id, get_string('notes', 'notes'));
}