MDL-14150 - Make tag:edit and tag:manage more distinct - related tags and description are now editing, renaming is managing. (merge from 1.9)

This commit is contained in:
scyrma 2008-04-28 08:27:10 +00:00
parent 2173417c72
commit 3efae234fa
2 changed files with 8 additions and 8 deletions

View File

@ -69,7 +69,7 @@ if ($tagnew = $tagform->get_data()) {
}
}
if (!has_capability('moodle/tag:manage', $systemcontext)) {
if (!has_capability('moodle/tag:manage', $systemcontext) && !has_capability('moodle/tag:edit', $systemcontext)) {
unset($tagnew->name);
unset($tagnew->rawname);
@ -87,9 +87,11 @@ if ($tagnew = $tagform->get_data()) {
$tagnew->timemodified = time();
// rename tag if needed
if (!tag_rename($tag->id, $tagnew->rawname)) {
print_error('Error updating tag record');
if (has_capability('moodle/tag:manage', $systemcontext)) {
// rename tag
if(!tag_rename($tag->id, $tagnew->rawname)) {
error('Error updating tag record');
}
}
//updated related tags

View File

@ -177,13 +177,11 @@ function tag_print_management_box($tag_object, $return=false) {
$links[] = '<a href="'. $CFG->wwwroot .'/tag/user.php?action=flaginappropriate&amp;sesskey='. sesskey() .'&amp;tag='. rawurlencode($tag_object->name) .'">'. get_string('flagasinappropriate', 'tag', rawurlencode($tagname)) .'</a>';
// Edit tag: Only people with moodle/tag:edit capability who either have it as an interest or can manage tags
if (has_capability('moodle/tag:edit', $systemcontext) &&
(tag_record_tagged_with('user', $USER->id, $tag_object->name) ||
has_capability('moodle/tag:manage', $systemcontext))) {
if (has_capability('moodle/tag:edit', $systemcontext) ||
has_capability('moodle/tag:manage', $systemcontext)) {
$links[] = '<a href="'. $CFG->wwwroot .'/tag/edit.php?tag='. rawurlencode($tag_object->name) .'">'. get_string('edittag', 'tag') .'</a>';
}
$output .= implode(' | ', $links);
$output .= print_box_end(true);
}