Pārlūkot izejas kodu

Fix issue not taking the state change in exercise sort order select box.
Display a warning tag when selecting a questions sort order based on questions categories and there are no categories (otherwise would show an empty categories table).

Yannick Warnier 8 gadi atpakaļ
vecāks
revīzija
c8c315bd1b
1 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  1. 4 1
      main/exercise/exercise.class.php

+ 4 - 1
main/exercise/exercise.class.php

@@ -2057,7 +2057,7 @@ class Exercise
                     $option,
                     array(
                         'id' => 'questionSelection',
-                        'onclick' => 'checkQuestionSelection()'
+                        'onchange' => 'checkQuestionSelection()'
                     )
                 );
 
@@ -2102,6 +2102,9 @@ class Exercise
                 // Category selection.
                 $cat = new TestCategory();
                 $cat_form = $cat->returnCategoryForm($this);
+                if (empty($cat_form)) {
+                    $cat_form = '<span class="label label-warning">' . get_lang('NoCategoriesDefined') . '</span>';
+                }
                 $form->addElement('label', null, $cat_form);
                 $form->addElement('html', '</div>');