]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-13728 - Tag form editing now provides a checkbox to set the tag type (official...
authorscyrma <scyrma>
Fri, 29 Feb 2008 09:35:04 +0000 (09:35 +0000)
committerscyrma <scyrma>
Fri, 29 Feb 2008 09:35:04 +0000 (09:35 +0000)
lang/en_utf8/tag.php
lib/db/access.php
tag/edit.php
tag/edit_form.php

index dfce19a0796a1959eb4737cff808d676f39c3b46..a9976fb937ed2d03fd681ebba2dc28f28e6b84c5 100644 (file)
@@ -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)';
index 87670253b1dd9a0a754d6cc102a51ffcec5ac523..3bb9f05fbc1c99263a61d3a943459604eed20d04 100644 (file)
@@ -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,
index 8da09367e67997a9cd01cc61196d576f93091782..e567e77da5b27e3c9e17ceb0c5ea4d62008b3449 100644 (file)
@@ -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);
index 4311b94a7e2bbfcb9a596cb71b96ab8f5be7a8a7..fbfdf067b895cd79661f22f961e919050ca91902 100644 (file)
@@ -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'));
 
     }