Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-33400

Activity modules are an exception to the rule when it comes to function/activity names

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Libraries
    • Labels:
    • Testing Instructions:
      Hide

      please re-run the test in MDL-22504 for drag and drop testing. especially for file, folder, page, and url activities.

      • test mod_assign : uploading files and downloading files from its assignments. (testing any single assignment type is enough)
      • test mod_quiz : create an essay question and download it.
      • test mod_data : file uploading to an entry and downloading it again.
      • test mod_assignment(2.2) : file uploading to a file type assignment and downloading.

      (the calls to plugin_callback() and get_plugin_list_with_function() already work fine with 'mod' so this is just resgression testing)

      Show
      please re-run the test in MDL-22504 for drag and drop testing. especially for file, folder, page, and url activities. test mod_assign : uploading files and downloading files from its assignments. (testing any single assignment type is enough) test mod_quiz : create an essay question and download it. test mod_data : file uploading to an entry and downloading it again. test mod_assignment(2.2) : file uploading to a file type assignment and downloading. (the calls to plugin_callback() and get_plugin_list_with_function() already work fine with 'mod' so this is just resgression testing)
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      Activity modules are an exception to the rule when it comes to function/activity names.

      http://docs.moodle.org/dev/Activity_modules

      Currently however I see that a lot of functions and classes prefixed with mod_ have crept into lib.php:

      # grep "function mod_" */lib.php
      assign/lib.php:function mod_assign_get_file_areas($course, $cm, $context) {
      assign/lib.php:function mod_assign_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) {
      assignment/lib.php:function mod_assignment_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) {
      data/lib.php:function mod_data_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) {
      folder/lib.php:function mod_folder_dndupload_register() {
      folder/lib.php:function mod_folder_dndupload_handle($uploadinfo) {
      glossary/lib.php:function mod_glossary_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) {
      page/lib.php:function mod_page_dndupload_register() {
      page/lib.php:function mod_page_dndupload_handle($uploadinfo) {
      quiz/lib.php:function mod_quiz_question_pluginfile($course, $context, $component,
      resource/lib.php:function mod_resource_dndupload_register() {
      resource/lib.php:function mod_resource_dndupload_handle($uploadinfo) {
      url/lib.php:function mod_url_dndupload_register() {
      url/lib.php:function mod_url_dndupload_handle($uploadinfo) {
       
      # grep "class mod_" */lib.php
      assignment/lib.php:class mod_assignment_grading_form extends moodleform {

      This makes the situation slightly insane for developers. I'd love to change everything to mod_ but that is just not an option right now. I think we need to change it back.

      This means:

      1) Renaming the functions for one callback type at a time.
      2) Fixing the calling code looking for these prefixes.

      Here is a detailed list of what I think we need to fix:

      1) Fix all _get_file_areas (assign)
      2) Fix all _get_file_info (assign, assignment, data, glossary)
      3) Fix all _dndupload_register (folder, page, resource, url) and calling code!
      4) Fix all _dndupload_handle (folder, page, resource, url) and calling code!

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  9 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    25/Jun/12