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

Some activity names aren't formatted in WebServices

XMLWordPrintable

    • MOODLE_38_STABLE
    • MOODLE_37_STABLE, MOODLE_38_STABLE
    • MDL-66877-master
    • Hide
      Test Web Services
      1. As admin, enable "Multi-language Content" filter in the site for content and headings (Site administration > Plugins > Filters > Manage filters)
      2. In a course, create an assignment activity, a database, and a lesson. In the name of the activity put this multilang text: <span lang="en" class="multilang">English</span><span lang="es" class="multilang">Español</span>
      3. Enrol one user as student or teacher in the course you just used
      4. Edit the user profile and force the language to English
      5. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      6. Create a Token in the mobile app service for the user you just enrolled
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. Replace also the COURSEID word with the course id where you created the activities

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=COURSEID&wsfunction=mod_data_get_databases_by_courses&wstoken=3af67232a7596ceb658df4db329e5ad6&moodlewssettingfilter=true' | python -m "json.tool"

      8. Confirm that:
        • Among the returned fields, you see a "name" field set to exactly "English"
      9. Now, execute the following curl request doing the same replacements than before:

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=COURSEID&wsfunction=mod_lesson_get_lessons_by_courses&wstoken=3af67232a7596ceb658df4db329e5ad6&moodlewssettingfilter=true' | python -m "json.tool"

      10. Confirm that:
        • Among the returned fields, you see a "name" field set to exactly "English"
      11. Now, execute the following curl request doing the same replacements than before:

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=COURSEID&wsfunction=mod_assign_get_assignments&wstoken=3af67232a7596ceb658df4db329e5ad6&moodlewssettingfilter=true' | python -m "json.tool"

      12. Confirm that:
        • Among the returned fields, you see a "name" field set to exactly "English"
      Test web change
      1. In the same course used for the previous test, create a "Survey" activity setting the multi-language text to the same one used in the previous test.
      2. Now, access to the "Choice"
      3. Go to the choice report via the "View X responses" link and confirm that
        • The choice name is just "English"
      4. In the same course used for the previous test, create a "Book" resource setting the multi-language text to the same one used in the previous test.
      5. Confirm that:
        • In the "Add new chapter" script you are redirected after creating the "Book", the name of the activity is just "English" (the name at the top of the page bjust ellow the breadcrumb)
      6. In the same course used for the previous test, create a "Survey" activity setting the multi-language text to the same one used in the previous test.
      7. Confirm that:
      8. When accesing the new Survey, the name of the activity is just "English" (the name at the top of the page just bellow the breadcrumb)
      Show
      Test Web Services As admin, enable "Multi-language Content" filter in the site for content and headings (Site administration > Plugins > Filters > Manage filters) In a course, create an assignment activity, a database, and a lesson. In the name of the activity put this multilang text: <span lang="en" class="multilang">English</span><span lang="es" class="multilang">Español</span> Enrol one user as student or teacher in the course you just used Edit the user profile and force the language to English Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for the user you just enrolled Click on Site administration ► Plugins ► Web services ► Manage tokens Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. Replace also the COURSEID word with the course id where you created the activities curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=COURSEID&wsfunction=mod_data_get_databases_by_courses&wstoken=3af67232a7596ceb658df4db329e5ad6&moodlewssettingfilter=true' | python -m "json.tool" Confirm that: Among the returned fields, you see a "name" field set to exactly "English" Now, execute the following curl request doing the same replacements than before: curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=COURSEID&wsfunction=mod_lesson_get_lessons_by_courses&wstoken=3af67232a7596ceb658df4db329e5ad6&moodlewssettingfilter=true' | python -m "json.tool" Confirm that: Among the returned fields, you see a "name" field set to exactly "English" Now, execute the following curl request doing the same replacements than before: curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=COURSEID&wsfunction=mod_assign_get_assignments&wstoken=3af67232a7596ceb658df4db329e5ad6&moodlewssettingfilter=true' | python -m "json.tool" Confirm that: Among the returned fields, you see a "name" field set to exactly "English" Test web change In the same course used for the previous test, create a "Survey" activity setting the multi-language text to the same one used in the previous test. Now, access to the "Choice" Go to the choice report via the "View X responses" link and confirm that The choice name is just "English" In the same course used for the previous test, create a "Book" resource setting the multi-language text to the same one used in the previous test. Confirm that: In the "Add new chapter" script you are redirected after creating the "Book", the name of the activity is just "English" (the name at the top of the page bjust ellow the breadcrumb) In the same course used for the previous test, create a "Survey" activity setting the multi-language text to the same one used in the previous test. Confirm that: When accesing the new Survey, the name of the activity is just "English" (the name at the top of the page just bellow the breadcrumb)

      The following WebServices don't format activity names:

      mod_assign_get_assignments

      mod_data_get_databases_by_courses

      mod_lesson_get_lessons_by_courses

      How to reproduce:

      1. Enable multilang filter in the site and in a course.
      2. Create an assign, a database and a lesson. In the name of the activity put some multilang text, e.g.: <span lang="en" class="multilang">English</span><span lang="es" class="multilang">Español</span>
      3. Call the WS that gets the activity and look at its name. It will contain the spans with multilang, but it should return only the right language without the span.

      On the other hand, in survey the opposite happens: the WebService formats the activity name, but Moodle web doesn't. If you create a survey with multilang tags in its name, it's correctly displayed in the course page and in breadcrumbs, but if you open it you will see both texts in the title.

            jleyva Juan Leyva
            dpalou Dani Palou
            Dani Palou Dani Palou
            Jake Dallimore Jake Dallimore
            Janelle Barcega Janelle Barcega
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours, 55 minutes
                6h 55m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.