Index: lang/en_utf8/assignment.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lang/en_utf8/assignment.php,v
retrieving revision 1.14.2.11
diff -u -r1.14.2.11 assignment.php
--- lang/en_utf8/assignment.php 27 Feb 2008 05:05:01 -0000 1.14.2.11
+++ lang/en_utf8/assignment.php 5 Dec 2008 22:31:30 -0000
@@ -10,6 +10,7 @@
$string['assignment:grade'] = 'Grade assignment';
$string['assignment:submit'] = 'Submit assignment';
$string['assignment:view'] = 'View assignment';
+$string['assignment:viewownsubmission'] = 'View own submission';
$string['assignmentdetails'] = 'Assignment details';
$string['assignmentmail'] = '$a->teacher has posted some feedback on your
assignment submission for \'$a->assignment\'
@@ -24,6 +25,7 @@
$string['assignmenttype'] = 'Assignment type';
$string['availabledate'] = 'Available from';
$string['cannotdeletefiles'] = 'An error occurred and files could not be deleted';
+$string['cantseesubmission'] = 'You don\'t have rights to view you submission';
$string['comment'] = 'Comment';
$string['commentinline'] = 'Comment inline';
$string['configitemstocount'] = 'Nature of items to be counted for student submissions in online assignments.';
Index: mod/assignment/db/access.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/assignment/db/access.php,v
retrieving revision 1.7.2.1
diff -u -r1.7.2.1 access.php
--- mod/assignment/db/access.php 23 Jul 2008 16:09:14 -0000 1.7.2.1
+++ mod/assignment/db/access.php 5 Dec 2008 20:52:14 -0000
@@ -55,6 +55,15 @@
)
),
+ 'mod/assignment:viewownsubmission' => array(
+
+ 'captype' => 'read',
+ 'contextlevel' => CONTEXT_MODULE,
+ 'legacy' => array(
+ 'student' => CAP_ALLOW
+ )
+ ),
+
'mod/assignment:grade' => array(
'riskbitmask' => RISK_XSS,
Index: mod/assignment/lib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/assignment/lib.php,v
retrieving revision 1.277.2.46
diff -u -r1.277.2.46 lib.php
--- mod/assignment/lib.php 23 Sep 2008 07:46:53 -0000 1.277.2.46
+++ mod/assignment/lib.php 5 Dec 2008 21:49:46 -0000
@@ -1663,9 +1663,10 @@
*
* @param $userid int optional id of the user. If 0 then $USER->id is used.
* @param $return boolean optional defaults to false. If true the list is returned rather than printed
+ * @param $link boolean optional defaults to true. If true the list is links to the files, if false - just static text
* @return string optional
*/
- function print_user_files($userid=0, $return=false) {
+ function print_user_files($userid=0, $return=false, $link=true) {
global $CFG, $USER;
if (!$userid) {
@@ -1686,9 +1687,13 @@
$icon = mimeinfo('icon', $file);
$ffurl = get_file_url("$filearea/$file", array('forcedownload'=>1));
-
- $output .= ''.
+ if($link){
+ $output .= '
'.
''.$file.'
';
+ } else {
+ $output .= ''
+ .$file.'
';
+ }
}
}
}
Index: mod/assignment/version.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/assignment/version.php,v
retrieving revision 1.53.2.4
diff -u -r1.53.2.4 version.php
--- mod/assignment/version.php 19 Mar 2008 23:18:59 -0000 1.53.2.4
+++ mod/assignment/version.php 5 Dec 2008 20:56:46 -0000
@@ -5,7 +5,7 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2007101511;
+$module->version = 2007101512;
$module->requires = 2007101509; // Requires this Moodle version
$module->cron = 60;
Index: mod/assignment/type/online/assignment.class.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/assignment/type/online/assignment.class.php,v
retrieving revision 1.46.2.8
diff -u -r1.46.2.8 assignment.class.php
--- mod/assignment/type/online/assignment.class.php 24 Jul 2008 11:11:58 -0000 1.46.2.8
+++ mod/assignment/type/online/assignment.class.php 7 Dec 2008 19:43:52 -0000
@@ -51,7 +51,6 @@
$options = new object();
$options->smiley = false;
$options->filter = false;
-
$defaults->text = format_text($submission->data1, $submission->data2, $options);
$defaults->format = FORMAT_HTML;
} else {
@@ -59,6 +58,10 @@
$defaults->format = $submission->data2;
}
}
+
+ if(!has_capability("mod/assignment:viewownsubmission", $context)){
+ $defaults->text='';//MDL-15356
+ }
$mform->set_data($defaults);
if ($mform->is_cancelled()) {
@@ -102,7 +105,11 @@
} else {
print_box_start('generalbox boxwidthwide boxaligncenter', 'online');
if ($submission) {
- echo format_text($submission->data1, $submission->data2);
+ if(has_capability("mod/assignment:viewownsubmission", $context)){
+ echo format_text($submission->data1, $submission->data2);
+ } else {
+ notify(get_string('cantseesubmission','assignment'));
+ }
} else if (!has_capability('mod/assignment:submit', $context)) { //fix for #4604
echo '