From 0b2cb1327ad5a9f3e9169fbb7cbf85e3a1acee49 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Wed, 10 Feb 2010 09:46:44 +0000 Subject: [PATCH] MDL-20204 added forgotten support for disabled in single_select --- admin/filters.php | 18 ++++++------------ lib/outputrenderers.php | 4 ++++ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/admin/filters.php b/admin/filters.php index aee822176d0..812fbd49c67 100644 --- a/admin/filters.php +++ b/admin/filters.php @@ -122,7 +122,7 @@ echo $OUTPUT->heading($title); $linkcontinue = new moodle_url($returnurl, array('action' => 'delete', 'filterpath' => $filterpath, 'confirm' => 1)); - $formcancel = new single_button($returnurl, get_string('no'), 'get'); + $formcancel = new single_button(new moodle_url($returnurl), get_string('no'), 'get'); echo $OUTPUT->confirm(get_string('deletefilterareyousuremessage', 'admin', $filtername), $linkcontinue, $formcancel); echo $OUTPUT->footer(); exit; @@ -225,9 +225,7 @@ /// Display helper functions =================================================== function filters_action_url($filterpath, $action) { - global $returnurl; - return $returnurl . '?sesskey=' . sesskey() . '&filterpath=' . - urlencode($filterpath) . '&action=' . $action; + return new moodle_url('/admin/filters.php', array('sesskey'=>sesskey(), 'filterpath'=>$filterpath, 'action'=>$action)); } function get_table_row($filterinfo, $isfirstrow, $islastactive, $applytostrings) { @@ -243,10 +241,8 @@ function get_table_row($filterinfo, $isfirstrow, $islastactive, $applytostrings) } // Disable/off/on - $select = html_select::make_popup_form(filters_action_url($filter, 'setstate'), 'newstate', $activechoices, 'active' . basename($filter), $filterinfo->active); - $select->nothinglabel = false; - $select->form->button->text = get_string('save', 'admin'); - $row[] = $OUTPUT->select($select); + $select = new single_select(filters_action_url($filter, 'setstate'), 'newstate', $activechoices, $filterinfo->active, null, 'active' . basename($filter)); + $row[] = $OUTPUT->render($select); // Re-order $updown = ''; @@ -266,11 +262,9 @@ function get_table_row($filterinfo, $isfirstrow, $islastactive, $applytostrings) $row[] = $updown; // Apply to strings. - $select = html_select::make_popup_form(filters_action_url($filter, 'setapplyto'), 'stringstoo', $applytochoices, 'applyto' . basename($filter), $applytostrings); - $select->nothinglabel = false; + $select = new single_select(filters_action_url($filter, 'setapplyto'), 'stringstoo', $applytochoices, $applytostrings, null, 'applyto' . basename($filter)); $select->disabled = $filterinfo->active == TEXTFILTER_DISABLED; - $select->form->button->text = get_string('save', 'admin'); - $row[] = $OUTPUT->select($select); + $row[] = $OUTPUT->render($select); // Settings link, if required if (filter_has_global_settings($filter)) { diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 2bf71c42c33..5c82451565a 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -1124,6 +1124,10 @@ class core_renderer extends renderer_base { $select->attributes['id'] = html_writer::random_id('single_select'); } + if ($select->disabled) { + $select->attributes['disabled'] = 'disabled'; + } + if ($select->tooltip) { $select->attributes['title'] = $select->tooltip; } -- 2.43.0