Skip to content

Commit

Permalink
MDL-43398 Wiki: Choose... options cause SQL errors or seen inappropri…
Browse files Browse the repository at this point in the history
…ate.
  • Loading branch information
mouneyrac authored and marinaglancy committed Mar 27, 2014
1 parent 9b8555f commit 3ef5218
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
5 changes: 1 addition & 4 deletions mod/wiki/pagelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1425,14 +1425,11 @@ function print_content() {
echo $this->wikioutput->menu_map($this->page->id, $this->view);
$this->print_index_content();
break;
case 5:
echo $this->wikioutput->menu_map($this->page->id, $this->view);
$this->print_page_list_content();
break;
case 6:
echo $this->wikioutput->menu_map($this->page->id, $this->view);
$this->print_updated_content();
break;
case 5:
default:
echo $this->wikioutput->menu_map($this->page->id, $this->view);
$this->print_page_list_content();
Expand Down
12 changes: 8 additions & 4 deletions mod/wiki/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ public function wiki_print_subwiki_selector($wiki, $subwiki, $page, $pagetype =
$baseurl->params($params);
$name = 'uid';
$selected = $subwiki->userid;
echo $this->output->single_select($baseurl, $name, $options, $selected);
echo $this->output->single_select($baseurl, $name, $options, $selected, null);
echo $this->output->container_end();
}
return;
Expand Down Expand Up @@ -404,7 +404,7 @@ public function wiki_print_subwiki_selector($wiki, $subwiki, $page, $pagetype =
$baseurl->params($params);
$name = 'groupanduser';
$selected = $subwiki->groupid . '-' . $subwiki->userid;
echo $this->output->single_select($baseurl, $name, $options, $selected);
echo $this->output->single_select($baseurl, $name, $options, $selected, null);
echo $this->output->container_end();

return;
Expand Down Expand Up @@ -451,7 +451,7 @@ public function wiki_print_subwiki_selector($wiki, $subwiki, $page, $pagetype =
$baseurl->params($params);
$name = 'groupanduser';
$selected = $subwiki->groupid . '-' . $subwiki->userid;
echo $this->output->single_select($baseurl, $name, $options, $selected);
echo $this->output->single_select($baseurl, $name, $options, $selected, null);
echo $this->output->container_end();

return;
Expand All @@ -469,6 +469,10 @@ public function wiki_print_subwiki_selector($wiki, $subwiki, $page, $pagetype =
}

function menu_map($pageid, $currentselect) {
if (empty($currentselect)) {
// The wiki uses digit number to match the options and 5 is the default one.
$currentselect = 5;
}
$options = array('contributions', 'links', 'orphaned', 'pageindex', 'pagelist', 'updatedpages');
$items = array();
foreach ($options as $opt) {
Expand Down Expand Up @@ -509,7 +513,7 @@ function menu_admin($pageid, $currentselect) {
foreach ($items as $key => $item) {
$selectoptions[$key + 1] = $item;
}
$select = new single_select(new moodle_url('/mod/wiki/admin.php', array('pageid' => $pageid)), 'option', $selectoptions, $currentselect);
$select = new single_select(new moodle_url('/mod/wiki/admin.php', array('pageid' => $pageid)), 'option', $selectoptions, $currentselect, null);
$select->label = get_string('adminmenu', 'wiki') . ': ';
return $this->output->container($this->output->render($select), 'midpad');
}
Expand Down

0 comments on commit 3ef5218

Please sign in to comment.