mirror of
https://github.com/moodle/moodle.git
synced 2025-04-16 14:02:32 +02:00
MDL-13728 - Tag form editing now provides a checkbox to set the tag type (official or not), and it's all base on tag:manage. (merge)
This commit is contained in:
parent
be4c1a81d6
commit
603443b519
@ -21,6 +21,7 @@ $string['name'] = 'Tag name';
|
||||
$string['namesalreadybeeingused'] = 'Tag names already being used';
|
||||
$string['newname'] = 'New tag name';
|
||||
$string['noresultsfor'] = 'No results for \"$a\"';
|
||||
$string['officialtag'] = 'Official tag';
|
||||
$string['owner'] = 'Owner';
|
||||
$string['otags'] = 'Official tags';
|
||||
$string['ptags'] = 'User defined tags (Comma separated)';
|
||||
|
@ -1139,17 +1139,6 @@ $moodle_capabilities = array(
|
||||
)
|
||||
),
|
||||
|
||||
'moodle/tag:changetype' => array(
|
||||
|
||||
'riskbitmask' => RISK_SPAM,
|
||||
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'legacy' => array(
|
||||
'admin' => CAP_ALLOW
|
||||
)
|
||||
),
|
||||
|
||||
'moodle/tag:create' => array(
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
|
14
tag/edit.php
14
tag/edit.php
@ -48,6 +48,11 @@ if (can_use_html_editor()) {
|
||||
$errorstring = '';
|
||||
|
||||
$tagform = new tag_edit_form();
|
||||
if ( $tag->tagtype == 'official' ) {
|
||||
$tag->tagtype = '1';
|
||||
} else {
|
||||
$tag->tagtype = '0';
|
||||
}
|
||||
$tagform->set_data($tag);
|
||||
|
||||
// If new data has been sent, update the tag record
|
||||
@ -55,6 +60,15 @@ if ($tagnew = $tagform->get_data()) {
|
||||
|
||||
tag_description_set($tag_id, stripslashes($tagnew->description), $tagnew->descriptionformat);
|
||||
|
||||
if (has_capability('moodle/tag:manage', $systemcontext)) {
|
||||
if (($tag->tagtype != 'default') && ($tagnew->tagtype != '1')) {
|
||||
tag_type_set($tag->id, 'default');
|
||||
|
||||
} elseif (($tag->tagtype != 'official') && ($tagnew->tagtype == '1')) {
|
||||
tag_type_set($tag->id, 'official');
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_capability('moodle/tag:manage', $systemcontext)) {
|
||||
unset($tagnew->name);
|
||||
unset($tagnew->rawname);
|
||||
|
@ -23,13 +23,16 @@ class tag_edit_form extends moodleform {
|
||||
|
||||
$mform->addElement('format', 'descriptionformat', get_string('format'));
|
||||
|
||||
if (has_capability('moodle/tag:manage', $systemcontext)) {
|
||||
$mform->addElement('checkbox', 'tagtype', get_string('officialtag', 'tag'));
|
||||
}
|
||||
|
||||
$mform->addElement('html', '<br/><div id="relatedtags-autocomplete-container">');
|
||||
$mform->addElement('textarea', 'relatedtags', get_string('relatedtags','tag'), 'cols="50" rows="3"');
|
||||
$mform->setType('relatedtags', PARAM_TAGLIST);
|
||||
$mform->addElement('html', '</div>');
|
||||
$mform->addElement('html', '<div id="relatedtags-autocomplete"></div>');
|
||||
|
||||
|
||||
$this->add_action_buttons(false, get_string('updatetag', 'tag'));
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user