mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
Fixing tags and comments issues.
This commit is contained in:
parent
b287039a8c
commit
ab42292001
@ -313,5 +313,22 @@ function xmldb_wiki_upgrade($oldversion) {
|
||||
//upgrade_mod_savepoint(true, 2010040120, 'wiki');
|
||||
}
|
||||
|
||||
if ($oldversion < 2010080201) {
|
||||
|
||||
$sql = "UPDATE {comments}
|
||||
SET commentarea = 'wiki_page'
|
||||
WHERE commentarea = 'wiki_comment_section'";
|
||||
$DB->execute($sql);
|
||||
|
||||
$sql = "UPDATE {tag_instance}
|
||||
SET itemtype = 'wiki_page'
|
||||
WHERE itemtype = 'wiki'";
|
||||
$DB->execute($sql);
|
||||
|
||||
echo $OUTPUT->notification('Updating comments and tags', 'notifysuccess');
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -43,6 +43,8 @@ class mod_wiki_edit_form extends moodleform {
|
||||
|
||||
$version = $this->_customdata['version'];
|
||||
$format = $this->_customdata['format'];
|
||||
$tags = !isset($this->_customdata['tags'])?"":$this->_customdata['tags'];
|
||||
|
||||
|
||||
if ($format != 'html') {
|
||||
$contextid = $this->_customdata['contextid'];
|
||||
@ -86,6 +88,7 @@ class mod_wiki_edit_form extends moodleform {
|
||||
if (!empty($CFG->usetags)) {
|
||||
$mform->addElement('header', 'tagshdr', get_string('tags', 'tag'));
|
||||
$mform->addElement('tags', 'tags', get_string('tags'));
|
||||
$mform->setDefault('tags', $tags);
|
||||
}
|
||||
|
||||
$buttongroup = array();
|
||||
|
@ -1085,7 +1085,7 @@ function wiki_get_comments($context, $pageid) {
|
||||
$cmt->context = $context;
|
||||
$cmt->itemid = $pageid;
|
||||
$cmt->pluginname = 'wiki';
|
||||
$cmt->area = 'wiki_comment_section';
|
||||
$cmt->area = 'wiki_page';
|
||||
$cmt->course = $course;
|
||||
$manager = new comment($cmt);
|
||||
|
||||
@ -1101,7 +1101,7 @@ function wiki_get_comments($context, $pageid) {
|
||||
function wiki_get_comments_by_user($userid) {
|
||||
global $DB;
|
||||
|
||||
$area = 'wiki_comment_section';
|
||||
$area = 'wiki_page';
|
||||
$sql = "SELECT c.*
|
||||
FROM {comments} c
|
||||
WHERE c.userid = ? and c.commentarea = ?";
|
||||
@ -1126,7 +1126,7 @@ function wiki_add_comment($context, $pageid, $content, $editor) {
|
||||
$cmt = new stdclass();
|
||||
$cmt->context = $context;
|
||||
$cmt->itemid = $pageid;
|
||||
$cmt->area = 'wiki_comment_section';
|
||||
$cmt->area = 'wiki_page';
|
||||
$cmt->course = $course;
|
||||
$cmt->pluginname = 'wiki';
|
||||
|
||||
@ -1157,7 +1157,7 @@ function wiki_delete_comment($idcomment, $context, $pageid) {
|
||||
$cmt = new stdclass;
|
||||
$cmt->context = $context;
|
||||
$cmt->itemid = $pageid;
|
||||
$cmt->area = 'wiki_comment_section';
|
||||
$cmt->area = 'wiki_page';
|
||||
$cmt->pluginname = 'wiki';
|
||||
$cmt->course = $course;
|
||||
|
||||
@ -1220,7 +1220,7 @@ function wiki_print_page_content($page, $context, $subwikiid) {
|
||||
echo $OUTPUT->box($html);
|
||||
|
||||
if (!empty($CFG->usetags)) {
|
||||
$tags = tag_get_tags_array('wiki', $page->id);
|
||||
$tags = tag_get_tags_array('wiki_page', $page->id);
|
||||
echo '<p class="wiki-tags"><span>Tags: </span>' . join($tags, ", ") . '</p>';
|
||||
}
|
||||
|
||||
|
@ -545,6 +545,10 @@ class page_wiki_edit extends page_wiki {
|
||||
$params['fileitemid'] = $this->subwiki->id;
|
||||
}
|
||||
|
||||
if (!empty($CFG->usetags)) {
|
||||
$params['tags'] = tag_get_tags_csv('wiki_page', $this->page->id, TAG_RETURN_TEXT);
|
||||
}
|
||||
|
||||
$form = new mod_wiki_edit_form($url, $params);
|
||||
|
||||
|
||||
@ -1937,7 +1941,7 @@ class page_wiki_save extends page_wiki_edit {
|
||||
$errors = $this->process_uploads($context);
|
||||
}
|
||||
if (!empty($CFG->usetags)) {
|
||||
tag_set('wiki', $this->page->id, $data->tags);
|
||||
tag_set('wiki_page', $this->page->id, $data->tags);
|
||||
}
|
||||
|
||||
$message = '<p>' . get_string('saving', 'wiki') . '</p>';
|
||||
|
@ -32,5 +32,5 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$module->version = 2010071900; // The current module version (Date: YYYYMMDDXX)
|
||||
$module->version = 2010080201; // The current module version (Date: YYYYMMDDXX)
|
||||
$module->cron = 0; // Period for cron to check this module (secs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user