Merge branch 'MDL-47959' of git://github.com/colchambers/moodle
authorDan Poltawski <dan@moodle.com>
Thu, 30 Oct 2014 14:24:35 +0000 (14:24 +0000)
committerDan Poltawski <dan@moodle.com>
Thu, 30 Oct 2014 14:24:35 +0000 (14:24 +0000)
mod/quiz/classes/output/edit_renderer.php
mod/quiz/classes/structure.php
mod/quiz/edit_rest.php
mod/quiz/tests/behat/editing_click_delete_icon.feature
mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-debug.js
mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-min.js
mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes.js
mod/quiz/yui/src/toolboxes/js/toolbox.js

index 3e5574c..b123e19 100644 (file)
@@ -939,6 +939,7 @@ class edit_renderer extends \plugin_renderer_base {
                 'confirmremovequestion',
                 'dragtoafter',
                 'dragtostart',
+                'numquestionsx',
                 'removepagebreak',
         ), 'quiz');
 
index c81f7ae..ac6405b 100644 (file)
@@ -613,6 +613,8 @@ class structure {
             question_delete_question($slot->questionid);
         }
 
+        unset($this->questions[$slot->questionid]);
+
         $this->refresh_page_numbers_and_update_db($quiz);
 
         $trans->allow_commit();
index 1896d34..9bfd958 100644 (file)
@@ -134,7 +134,7 @@ switch($requestmethod) {
                 quiz_delete_previews($quiz);
                 quiz_update_sumgrades($quiz);
                 echo json_encode(array('newsummarks' => quiz_format_grade($quiz, $quiz->sumgrades),
-                            'deleted' => true));
+                            'deleted' => true, 'newnumquestions' => $structure->get_question_count()));
                 break;
         }
         break;
index 60f0bcf..a2b47ae 100644 (file)
@@ -38,6 +38,8 @@ Feature: Edit quiz page - delete
     And I should see "Question B" on quiz page "1"
     And I should see "Question C" on quiz page "2"
     And I should see "Total of marks: 3.00"
+    And I should see "Questions: 3"
+    And I should see "This quiz is open"
 
     # Delete last question in last page. Page contains multiple questions
     When I delete "Question C" in the quiz by clicking the delete icon
@@ -45,6 +47,7 @@ Feature: Edit quiz page - delete
     And I should see "Question B" on quiz page "1"
     And I should not see "Question C" on quiz page "2"
     And I should see "Total of marks: 2.00"
+    And I should see "Questions: 2"
 
     # Delete last question in last page. The page contains multiple questions and there are multiple pages.
     When I click on the "Add" page break icon after question "Question A"
index e005dd6..46637e9 100644 (file)
Binary files a/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-debug.js and b/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-debug.js differ
index 963665b..ce8eba7 100644 (file)
Binary files a/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-min.js and b/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-min.js differ
index e005dd6..46637e9 100644 (file)
Binary files a/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes.js and b/mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes.js differ
index 2e1eb75..d87f4f7 100644 (file)
@@ -51,6 +51,7 @@
         INSTANCEMAXMARK : 'span.instancemaxmark',
         MODINDENTDIV : '.mod-indent',
         MODINDENTOUTER : '.mod-indent-outer',
+        NUMQUESTIONS : '.numberofquestions',
         PAGECONTENT : 'div#page-content',
         PAGELI : 'li.page',
         SECTIONUL : 'ul.section',
@@ -124,6 +125,9 @@ Y.extend(TOOLBOX, Y.Base, {
                     if (responsetext.newsummarks) {
                         Y.one(SELECTOR.SUMMARKS).setHTML(responsetext.newsummarks);
                     }
+                    if (responsetext.newnumquestions) {
+                        Y.one(SELECTOR.NUMQUESTIONS).setHTML(M.util.get_string('numquestionsx', 'quiz', responsetext.newnumquestions));
+                    }
                     if (success_callback) {
                         Y.bind(success_callback, this, responsetext)();
                     }