Issue Details (XML | Word | Printable)

Key: MDL-17361
Type: Sub-task Sub-task
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Tim Hunt
Reporter: Olli Savolainen
Votes: 0
Watchers: 0
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle
MDL-17284

$mform->hardFreeze('parent'); breaks the form /question/category_form_randomquestion.php

Created: 23/Nov/08 01:24 AM   Updated: 26/Nov/08 01:25 PM
Return to search
Component/s: Quiz
Affects Version/s: 2.0
Fix Version/s: 2.0

Participants: Olli Savolainen and Tim Hunt
Security Level: None
Difficulty: Moderate
Resolved date: 26/Nov/08
Affected Branches: MOODLE_20_STABLE
Fixed Branches: MOODLE_20_STABLE


 Description  « Hide
            //TODO: Tim? why does the above evaluate true, breaking the form?
            // and more importantly, if this is a valid situation, how should we react,
            // that is, what does this mean?
            //$mform->hardFreeze('parent');

"By the way, the purpose of the code

        if (1 == $DB->count_records_sql("SELECT count(*)
                                           FROM {question_categories} c1,
                                                {question_categories} c2
                                          WHERE c2.id = ?
                                            AND c1.contextid = c2.contextid", array($currentcat))){
            $mform->hardFreeze('parent');
        }

Well, the SQL is counting the number of other categories belonging to the same context as this one. If there is only one, then it is trying to stop you changing the parent (so you can't remove the default category from any context.) However, that should not apply when you are creating a new context. (That applies to the standard create category form too.) Can you either fix this, or create a new issues assigned to me."

If the check does not apply, perhaps remove it, or debug the reason behind it?

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
tjhunt committed 2 files to 'Moodle CVS' - 26/Nov/08 01:25 PM
MDL-17361 Problems with the question category editing forms.

When editing an existing category, the logic should have been to prevent you from moving the category if it was the last remaining top-level category in its context.

When creating a new category as part of creating a random question, there should be no restriction.
MODIFY question/category_form_randomquestion.php   Rev. 1.3    (+1 -11 lines)
MODIFY question/category_form.php   Rev. 1.6    (+5 -1 lines)