diff --git a/lang/en_utf8/help/notes.php b/lang/en_utf8/help/notes.php new file mode 100755 index 00000000000..7840ca69e6f --- /dev/null +++ b/lang/en_utf8/help/notes.php @@ -0,0 +1,30 @@ +name - $a->date'; +$string['publishstate'] = 'Status'; +$string['personal'] = 'personal'; +$string['course'] = 'course'; +$string['site'] = 'site'; \ No newline at end of file diff --git a/lang/en_utf8/help/notes/status.html b/lang/en_utf8/help/notes/status.html new file mode 100755 index 00000000000..1034e93614b --- /dev/null +++ b/lang/en_utf8/help/notes/status.html @@ -0,0 +1,8 @@ +
There are 3 possible settings here
+' . get_string('addnewnote', 'notes') . '
'; - } - note_print_notes(get_string('sitenotes', 'notes'), $context, 0, $userid, NOTES_STATE_SITE, 0); - note_print_notes(get_string('coursenotes', 'notes'), $context, $courseid, $userid, NOTES_STATE_PUBLIC, 0); - note_print_notes(get_string('personalnotes', 'notes'), $context, $courseid, $userid, NOTES_STATE_DRAFT, $USER->id); + $addid = has_capability('moodle/notes:manage', $context) ? $courseid : 0; + $view = has_capability('moodle/notes:view', $context); + note_print_notes('' . $strsitenotes, $addid, $view, 0, $userid, NOTES_STATE_SITE, 0); + note_print_notes('' . $strcoursenotes, $addid, $view, $courseid, $userid, NOTES_STATE_PUBLIC, 0); + note_print_notes('' . $strpersonalnotes, $addid, $view, $courseid, $userid, NOTES_STATE_DRAFT, $USER->id); } else { - $context = get_context_instance(CONTEXT_SYSTEM); - note_print_notes(get_string('sitenotes', 'notes'), $context, 0, $userid, NOTES_STATE_SITE, 0); + echo '' . $strsitenotes . ' | ' . $strcoursenotes . ''; + $view = has_capability('moodle/notes:view', get_context_instance(CONTEXT_SYSTEM)); + note_print_notes('' . $strsitenotes, 0, $view, 0, $userid, NOTES_STATE_SITE, 0); + echo ''; if($userid) { $courses = get_my_courses($userid); foreach($courses as $c) { $header = '' . $c->fullname . ''; - note_print_notes($header, $context, $c->id, $userid, NOTES_STATE_PUBLIC, 0); + if (has_capability('moodle/notes:manage', get_context_instance(CONTEXT_COURSE, $c->id))) { + $addid = $c->id; + }else { + $addid = 0; + } + note_print_notes($header, $addid, $view, $c->id, $userid, NOTES_STATE_PUBLIC, 0); } } } add_to_log($courseid, 'notes', 'view', 'index.php?course='.$courseid.'&user='.$userid, 'view notes'); -print_footer($course); +print_footer($course); \ No newline at end of file diff --git a/notes/lib.php b/notes/lib.php index b097580ceb2..7dfd6ffdd83 100644 --- a/notes/lib.php +++ b/notes/lib.php @@ -4,15 +4,6 @@ * Library of functions and constants for notes */ -/** - * Constants for ratings. - */ -define('NOTES_RATING_LOW', '1'); -define('NOTES_RATING_BELOWNORMAL', '2'); -define('NOTES_RATING_NORMAL', '3'); -define('NOTES_RATING_ABOVENORMAL', '4'); -define('NOTES_RATING_HIGH', '5'); - /** * Constants for states. */ @@ -57,7 +48,7 @@ function note_list($courseid=0, $userid=0, $state = '', $author = 0, $order='las } $selects[] = 'module="notes"'; $select = implode(' AND ', $selects); - $fields = 'id,courseid,userid,content,format,rating,created,lastmodified,usermodified,publishstate'; + $fields = 'id,courseid,userid,content,format,created,lastmodified,usermodified,publishstate'; // retrieve data $rs =& get_recordset_select('post', $select, $order, $fields, $limitfrom, $limitnum); return recordset_to_array($rs); @@ -70,7 +61,7 @@ function note_list($courseid=0, $userid=0, $state = '', $author = 0, $order='las * @return note object */ function note_load($note_id) { - $fields = 'id,courseid,userid,content,format,rating,created,lastmodified,usermodified,publishstate'; + $fields = 'id,courseid,userid,content,format,created,lastmodified,usermodified,publishstate'; return get_record_select('post', 'id=' . $note_id . ' AND module="notes"', $fields); } @@ -87,9 +78,6 @@ function note_save(&$note) { $note->module = 'notes'; $note->lastmodified = time(); $note->usermodified = $USER->id; - if(empty($note->rating)) { - $note->rating = NOTES_RATING_NORMAL; - } if(empty($note->format)) { $note->format = FORMAT_PLAIN; } @@ -124,36 +112,6 @@ function note_delete($noteid) { return delete_records_select('post', 'id=' . $noteid . ' AND module="notes"'); } -/** - * Converts a rating value to its corespondent name - * - * @param int $rating rating value to convert - * @return string corespondent rating name - */ -function note_get_rating_name($rating) { - // cache rating names - static $ratings; - if (empty($ratings)) { - $ratings =& note_get_rating_names(); - } - return @$ratings[$rating]; -} - -/** - * Returns an array of mappings from rating values to rating names - * - * @return array of mappings - */ -function note_get_rating_names() { - return array( - 1 => get_string('low', 'notes'), - 2 => get_string('belownormal', 'notes'), - 3 => get_string('normal', 'notes'), - 4 => get_string('abovenormal', 'notes'), - 5 => get_string('high', 'notes'), - ); -} - /** * Converts a state value to its corespondent name * @@ -200,13 +158,12 @@ function note_print($note, $detail = NOTES_SHOW_FULL) { ($note->usermodified == $USER->id ? ' ownnotepost' : '') . '" id="note-'. $note->id .'">'; - // print note head (e.g. author, user refering to, rating, etc) + // print note head (e.g. author, user refering to, etc) if($detail & NOTES_SHOW_HEAD) { echo '' . get_string('addnewnote', 'notes') . '
'; + } + if ($viewnotes) { $notes =& note_list($courseid, $userid, $state, $author); if($notes) { note_print_list($notes); @@ -275,4 +236,4 @@ function note_print_notes($header, $context, $courseid = 0, $userid = 0, $state } else { echo '' . get_string('notesnotvisible', 'notes') . '
'; } -} +} \ No newline at end of file diff --git a/notes/version.php b/notes/version.php index fe471b86d92..1b804de7b19 100644 --- a/notes/version.php +++ b/notes/version.php @@ -5,5 +5,5 @@ /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$note_version = 2007070300; // The current version of note module (Date: YYYYMMDDXX) +$note_version = 2007070700; // The current version of note module (Date: YYYYMMDDXX) $module->cron = 1800; // Period for cron to check this module (secs) diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index cee5b695e7a..d9573842d2f 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -2377,10 +2377,9 @@ body#message-messages { ***/ .notepost { margin-bottom: 1em; - background-color: #F0F0F0; + background-color: #EEE; } .sitenotepost { - background-color: #FFFFF0; } .coursenotepost { } @@ -2393,6 +2392,8 @@ body#message-messages { } .notepost .header { + background: #DDD; + padding: 5px; } .notepost .user { @@ -2401,22 +2402,19 @@ body#message-messages { .notepost .userpicture { float: left; - margin: 5px; + margin-right: 5px; } -.notepost .rating5 { - color: red; -} -.notepost .rating1 { - color: orange; -} -.notepost .info, .notepost .rating { + +.notepost .info { font-size: smaller; } .notepost .content { + clear: both; } .notepost .footer { + clear: both; } /*** diff --git a/user/addnote.php b/user/addnote.php index 731e283bf14..07adf8127d8 100644 --- a/user/addnote.php +++ b/user/addnote.php @@ -5,7 +5,6 @@ require_once($CFG->dirroot .'/notes/lib.php'); $id = required_param('id', PARAM_INT); // course id $users = optional_param('userid', array(), PARAM_INT); // array of user id $contents = optional_param('contents', array(), PARAM_RAW); // array of user notes -$ratings = optional_param('ratings', array(), PARAM_INT); // array of notes ratings $states = optional_param('states', array(), PARAM_ALPHA); // array of notes states if (! $course = get_record('course', 'id', $id)) { error("Course ID is incorrect"); @@ -18,7 +17,7 @@ require_login($course->id); require_capability('moodle/notes:manage', $context); if (!empty($users) && confirm_sesskey()) { - if (count($users) != count($contents) || count($users) != count($ratings) || count($users) != count($states)) { + if (count($users) != count($contents) || count($users) != count($states)) { error('Parameters malformation', $CFG->wwwroot.'/user/index.php?id='.$id); } @@ -31,7 +30,6 @@ if (!empty($users) && confirm_sesskey()) { } $note->id = 0; $note->content = $contents[$k]; - $note->rating = $ratings[$k]; $note->publishstate = $states[$k]; $note->userid = $v; if (note_save($note)) { @@ -59,9 +57,11 @@ print_heading($straddnote); echo ''; print_footer($course);