mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
Forum MDL-25170 Discussion move feature should have button so you don't do it by accident (again)
This commit is contained in:
parent
afe38b79c6
commit
15e48a1a49
@ -650,18 +650,26 @@ class url_select implements renderable {
|
||||
* @var array of component_action
|
||||
*/
|
||||
var $helpicon = null;
|
||||
/**
|
||||
* @var string If set, makes button visible with given name for button
|
||||
*/
|
||||
var $showbutton = null;
|
||||
/**
|
||||
* Constructor
|
||||
* @param array $urls list of options
|
||||
* @param string $selected selected element
|
||||
* @param array $nothing
|
||||
* @param string $formid
|
||||
* @param string $showbutton Set to text of button if it should be visible
|
||||
* or null if it should be hidden (hidden version always has text 'go')
|
||||
*/
|
||||
public function __construct(array $urls, $selected='', $nothing=array(''=>'choosedots'), $formid=null) {
|
||||
$this->urls = $urls;
|
||||
$this->selected = $selected;
|
||||
$this->nothing = $nothing;
|
||||
$this->formid = $formid;
|
||||
public function __construct(array $urls, $selected='', $nothing=array(''=>'choosedots'),
|
||||
$formid=null, $showbutton=null) {
|
||||
$this->urls = $urls;
|
||||
$this->selected = $selected;
|
||||
$this->nothing = $nothing;
|
||||
$this->formid = $formid;
|
||||
$this->showbutton = $showbutton;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1293,11 +1293,14 @@ class core_renderer extends renderer_base {
|
||||
$output .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'sesskey', 'value'=>sesskey()));
|
||||
$output .= html_writer::select($urls, 'jump', $selected, $select->nothing, $select->attributes);
|
||||
|
||||
$go = html_writer::empty_tag('input', array('type'=>'submit', 'value'=>get_string('go')));
|
||||
$output .= html_writer::tag('noscript', html_writer::tag('div', $go), array('style'=>'inline'));
|
||||
|
||||
$nothing = empty($select->nothing) ? false : key($select->nothing);
|
||||
$output .= $this->page->requires->js_init_call('M.util.init_url_select', array($select->formid, $select->attributes['id'], $nothing));
|
||||
if (!$select->showbutton) {
|
||||
$go = html_writer::empty_tag('input', array('type'=>'submit', 'value'=>get_string('go')));
|
||||
$output .= html_writer::tag('noscript', html_writer::tag('div', $go), array('style'=>'inline'));
|
||||
$nothing = empty($select->nothing) ? false : key($select->nothing);
|
||||
$output .= $this->page->requires->js_init_call('M.util.init_url_select', array($select->formid, $select->attributes['id'], $nothing));
|
||||
} else {
|
||||
$output .= html_writer::empty_tag('input', array('type'=>'submit', 'value'=>$select->showbutton));
|
||||
}
|
||||
|
||||
// then div wrapper for xhtml strictness
|
||||
$output = html_writer::tag('div', $output);
|
||||
|
@ -232,7 +232,9 @@
|
||||
}
|
||||
if (!empty($forummenu)) {
|
||||
echo '<div class="movediscussionoption">';
|
||||
$select = new url_select($forummenu, '', array(''=>get_string("movethisdiscussionto", "forum")), 'forummenu');
|
||||
$select = new url_select($forummenu, '',
|
||||
array(''=>get_string("movethisdiscussionto", "forum")),
|
||||
'forummenu', get_string('move'));
|
||||
echo $OUTPUT->render($select);
|
||||
echo "</div>";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user