MDL-20204 added forgotten support for disabled in single_select
authorPetr Skoda <skodak@moodle.org>
Wed, 10 Feb 2010 09:46:44 +0000 (09:46 +0000)
committerPetr Skoda <skodak@moodle.org>
Wed, 10 Feb 2010 09:46:44 +0000 (09:46 +0000)
admin/filters.php
lib/outputrenderers.php

index aee8221..812fbd4 100644 (file)
             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;
 /// Display helper functions ===================================================
 
 function filters_action_url($filterpath, $action) {
-    global $returnurl;
-    return $returnurl . '?sesskey=' . sesskey() . '&amp;filterpath=' .
-            urlencode($filterpath) . '&amp;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)) {
index 2bf71c4..5c82451 100644 (file)
@@ -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;
         }