mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-19756 Fixed regression in popup_form()
This commit is contained in:
parent
b0a5e1bf59
commit
0affac4d65
3 changed files with 26 additions and 19 deletions
|
@ -15,11 +15,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($jump, $CFG->wwwroot) === 0) { // Anything on this site
|
if (strpos($jump, $CFG->wwwroot) === 0) { // Anything on this site
|
||||||
redirect(urldecode($jump));
|
redirect(new moodle_url(urldecode($jump)));
|
||||||
} else if (preg_match('/^[a-z]+\.php\?/', $jump)) {
|
} else if (preg_match('/^[a-z]+\.php\?/', $jump)) {
|
||||||
redirect(urldecode($jump));
|
redirect(new moodle_url(urldecode($jump)));
|
||||||
}
|
}
|
||||||
|
|
||||||
redirect($_SERVER['HTTP_REFERER']); // Return to sender, just in case
|
redirect(new moodle_url($_SERVER['HTTP_REFERER'])); // Return to sender, just in case
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -3339,22 +3339,22 @@ function popup_form($baseurl, $options, $formid, $selected='', $nothing='choose'
|
||||||
|
|
||||||
// debugging('popup_form() has been deprecated. Please change your code to use $OUTPUT->select($dateselector).');
|
// debugging('popup_form() has been deprecated. Please change your code to use $OUTPUT->select($dateselector).');
|
||||||
|
|
||||||
if (!empty($optionsextra)) {
|
|
||||||
debugging('the optionsextra param has been deprecated in popup_form, it will be ignored.', DEBUG_DEVELOPER);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($options)) {
|
if (empty($options)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$select = moodle_select::make_popup_form($baseurl, $options, $formid, $submitvalue, $selected);
|
|
||||||
$select->disabled = $disabled;
|
|
||||||
|
|
||||||
// Extract the last param of the baseurl for the name of the select
|
foreach ($options as $var => $val) {
|
||||||
if (preg_match('/([a-z_]*)=$/', $baseurl, $matches)) {
|
$url = new moodle_url($baseurl . $var);
|
||||||
$select->name = $matches[1];
|
if (!empty($optionsextra[$var])) {
|
||||||
$select->form->url->remove_params(array($matches[1]));
|
new moodle_url($baseurl . $var . $optionsextra[$var]);
|
||||||
|
}
|
||||||
|
$options[$url->out(false, array(), false)] = $val;
|
||||||
|
unset($options[$var]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$select = moodle_select::make_popup_form($options, $formid, $submitvalue, $selected);
|
||||||
|
$select->disabled = $disabled;
|
||||||
|
|
||||||
if ($nothing == 'choose') {
|
if ($nothing == 'choose') {
|
||||||
$select->nothinglabel = '';
|
$select->nothinglabel = '';
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2684,12 +2684,15 @@ class moodle_core_renderer extends moodle_renderer_base {
|
||||||
$this->prepare_event_handlers($image);
|
$this->prepare_event_handlers($image);
|
||||||
|
|
||||||
$attributes = array('class' => $image->get_classes_string(),
|
$attributes = array('class' => $image->get_classes_string(),
|
||||||
'style' => $this->prepare_legacy_width_and_height($image),
|
|
||||||
'src' => prepare_url($image->src),
|
'src' => prepare_url($image->src),
|
||||||
'alt' => $image->alt,
|
'alt' => $image->alt,
|
||||||
|
'style' => $image->style,
|
||||||
'title' => $image->title,
|
'title' => $image->title,
|
||||||
'id' => $image->id);
|
'id' => $image->id);
|
||||||
|
|
||||||
|
if (!empty($image->height) || !empty($image->width)) {
|
||||||
|
$attributes['style'] .= $this->prepare_legacy_width_and_height($image);
|
||||||
|
}
|
||||||
return $this->output_empty_tag('img', $attributes);
|
return $this->output_empty_tag('img', $attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3417,6 +3420,10 @@ class moodle_html_component {
|
||||||
* @var string $alt value to use for the alt attribute of this HTML tag.
|
* @var string $alt value to use for the alt attribute of this HTML tag.
|
||||||
*/
|
*/
|
||||||
public $alt = '';
|
public $alt = '';
|
||||||
|
/**
|
||||||
|
* @var string $style value to use for the style attribute of this HTML tag.
|
||||||
|
*/
|
||||||
|
public $style = '';
|
||||||
/**
|
/**
|
||||||
* @var array class names to add to this HTML element.
|
* @var array class names to add to this HTML element.
|
||||||
*/
|
*/
|
||||||
|
@ -3755,6 +3762,7 @@ class moodle_select extends moodle_html_component {
|
||||||
} else {
|
} else {
|
||||||
$inoptgroup = false;
|
$inoptgroup = false;
|
||||||
$optgroup = false;
|
$optgroup = false;
|
||||||
|
|
||||||
foreach ($options as $value => $display) {
|
foreach ($options as $value => $display) {
|
||||||
if ($display == '--') { /// we are ending previous optgroup
|
if ($display == '--') { /// we are ending previous optgroup
|
||||||
$this->options[] = $optgroup;
|
$this->options[] = $optgroup;
|
||||||
|
@ -3813,7 +3821,6 @@ class moodle_select extends moodle_html_component {
|
||||||
$this->options[] = $optgroup;
|
$this->options[] = $optgroup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::prepare();
|
parent::prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3915,13 +3922,14 @@ class moodle_select extends moodle_html_component {
|
||||||
* @param string $selected The option that is initially selected
|
* @param string $selected The option that is initially selected
|
||||||
* @return moodle_select A menu initialised as a popup form.
|
* @return moodle_select A menu initialised as a popup form.
|
||||||
*/
|
*/
|
||||||
public function make_popup_form($baseurl, $options, $formid, $submitvalue='', $selected=null) {
|
public function make_popup_form($options, $formid, $submitvalue='', $selected=null) {
|
||||||
|
global $CFG;
|
||||||
$select = self::make($options, 'jump', $selected);
|
$select = self::make($options, 'jump', $selected);
|
||||||
$select->form = new html_form();
|
$select->form = new html_form();
|
||||||
$select->form->id = $formid;
|
$select->form->id = $formid;
|
||||||
$select->form->method = 'get';
|
$select->form->method = 'get';
|
||||||
$select->form->add_class('popupform');
|
$select->form->add_class('popupform');
|
||||||
$select->form->url = new moodle_url($baseurl);
|
$select->form->url = new moodle_url($CFG->wwwroot . '/course/jumpto.php', array('sesskey' => sesskey()));
|
||||||
$select->form->button->text = get_string('go');
|
$select->form->button->text = get_string('go');
|
||||||
|
|
||||||
if (!empty($submitvalue)) {
|
if (!empty($submitvalue)) {
|
||||||
|
@ -3929,7 +3937,6 @@ class moodle_select extends moodle_html_component {
|
||||||
}
|
}
|
||||||
|
|
||||||
$select->id = $formid . '_jump';
|
$select->id = $formid . '_jump';
|
||||||
$select->baseurl = $baseurl;
|
|
||||||
|
|
||||||
$select->add_action('change', 'submit_form_by_id', array('id' => $formid, 'selectid' => $select->id));
|
$select->add_action('change', 'submit_form_by_id', array('id' => $formid, 'selectid' => $select->id));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue