Permalink
Browse files

MDL-35653 - mod/wiki: Force format now lets users edit wiki pages.

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.
  • Loading branch information...
1 parent 4c7e6ea commit c6b458edceb051c5cefd69d3fa316887a1bd4bdc @abgreeve abgreeve committed Nov 30, 2012
Showing with 5 additions and 3 deletions.
  1. +3 −3 mod/wiki/create.php
  2. +2 −0 mod/wiki/pagelib.php
View
6 mod/wiki/create.php
@@ -111,14 +111,14 @@
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();
View
2 mod/wiki/pagelib.php
@@ -937,6 +937,8 @@ function create_page($pagetitle) {
$data = $this->mform->get_data();
if (isset($data->groupinfo)) {
$groupid = $data->groupinfo;
+ } else if (!empty($this->gid)) {
+ $groupid = $this->gid;
} else {
$groupid = '0';
}

0 comments on commit c6b458e

Please sign in to comment.