Issue Details (XML | Word | Printable)

Key: MDL-17293
Type: Sub-task Sub-task
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Olli Savolainen
Reporter: Tim Hunt
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

Problem in edit_single_category in question/category_class.php

Created: 19/Nov/08 03:38 PM   Updated: 23/Nov/08 01:32 AM
Return to search
Component/s: Questions
Affects Version/s: 2.0
Fix Version/s: 2.0

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


 Description  « Hide
The two lines

            $this->catform_rand->set_data($category);
            $this->catform_rand->display();

Should not be present. To see why, go to Question Bank management -> Categories tab -> Click on the edit icon next to a category.

You end up on a page with two forms, when only the top one should be present.


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.


        //TODO: Tim: is this questionable? to add a hidden field right from a get parameter?
        $mform->addElement('hidden', 'addonpage', optional_param("addonpage_form", 0, PARAM_SEQUENCE), 'id="rform_qpage"');

Yes, that is questionable. You should do the optional_param call on the page that loads the form, and pass the data in via the call to set_data. Hmm that is tricky, because the call to set_data is in the initialize method. It might be better to call set_data in display_randomquestion_user_interface(), and pass $addonpage as an argument to that.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Olli Savolainen made changes - 23/Nov/08 01:32 AM
Field Original Value New Value
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]