From eb883f0fa4bfa37da5b2f595598bfd138abb6b4c Mon Sep 17 00:00:00 2001 From: Adrian Greeve Date: Fri, 30 Nov 2012 15:00:19 +0800 Subject: [PATCH] MDL-35653 - mod/wiki: Force format now lets users edit wiki pages. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to Tõnis Tartes for part of this solution. When force format was selected in the options, trying to view the wiki would redirect to the front page with a message saying that you do not have permission to edit this page. Students had no way of viewing any entries or creating the first page. When in force format it skips a page , which would be considered uncessary for students, but this means that the group id is not set and this is what is causing most of the problems. I also have included a check to see if the title is default and whether the user has permission to view all groups. In these situations the intermediate page is displayed. --- mod/wiki/create.php | 6 +++--- mod/wiki/pagelib.php | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mod/wiki/create.php b/mod/wiki/create.php index 69766b8eb92..3c1c49b99cd 100644 --- a/mod/wiki/create.php +++ b/mod/wiki/create.php @@ -111,14 +111,14 @@ case 'create': redirect($CFG->wwwroot . '/mod/wiki/edit.php?pageid='.$newpageid); break; case 'new': - if ((int)$wiki->forceformat == 1 && !empty($title)) { + // Go straight to editing if we know the page title and we're in force format mode. + if ((int)$wiki->forceformat == 1 && $title != get_string('newpage', 'wiki')) { $newpageid = $wikipage->create_page($title); add_to_log($course->id, 'wiki', 'add page', "view.php?pageid=".$newpageid, $newpageid, $cm->id); redirect($CFG->wwwroot . '/mod/wiki/edit.php?pageid='.$newpageid); } else { - // create link from moodle navigation block without pagetitle $wikipage->print_header(); - // new page without page title + // Create a new page. $wikipage->print_content($title); } $wikipage->print_footer(); diff --git a/mod/wiki/pagelib.php b/mod/wiki/pagelib.php index afea1a361f2..6779d80aab6 100644 --- a/mod/wiki/pagelib.php +++ b/mod/wiki/pagelib.php @@ -936,6 +936,8 @@ class page_wiki_create extends page_wiki { $data = $this->mform->get_data(); if (isset($data->groupinfo)) { $groupid = $data->groupinfo; + } else if (!empty($this->gid)) { + $groupid = $this->gid; } else { $groupid = '0'; }