Non-core contributed modules

Progress Bar does not respect multilang strings

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 2.0.3
  • Fix Version/s: 2.1.5
  • Component/s: Block: Progress
  • Labels:
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_21_STABLE

Description

I've found a bug in your progress bar block.
When the title of the monitored quizzes have multilang text, the box
isn't displayed correctly (easy to reproduce). The problem isn't the
length of the title text caused by mutlilang (...) but definitely
the multilang content itself.

Here some steps for the replication of the multilang problem (Moodle 2.0.3+):

1. Enable multilang filter (Site administration -> Plugins -> Filters -> Multi-Language Content ON (Content and headings)
2. Create a quiz in a course: For its name, use multilang code, e.g.:
<span lang="en" class="multilang">This is a test</span><span lang="de" class="multilang">Dies ist ein Test</span>
(you don't need to install the second language)
3. After creation, check if you only see the English phrase in your course (when language turned to English ) and not the (in this case) German one. If you see something like "This is a testDies ist ein Test", something went wrong.
4. If it's all correct, just add a progress bar block and monitor this quiz. Now you should see the problem

Another bug with multilang: Just copy above code in your progress bar configuration field "Block instance title". Then you will see your title displayed the way mentioned in (3).

Enclosed you can find a screenshot showing both bugs.

I fixed them and now it seems to work properly using multiple languages. (tested by myself using two languages)
But while testing this, two other bugs appeared. These new bugs do not result from my code changes, they are also present in your latest version.

They are easy to reproduce:

a) ERROR: SESSKEY MISSING
--> WHEN CHANGING THE LANGUAGE IN "EDIT PROGRESS BAR MODE"!

b) ERROR: COURSEID MISSING
--> WHEN CHANGING THE LANGUAGE IN "OVERVIEW OF STUDENTS"!

Finally, here my fixes to solve the multilang bugs (just add some "format_string()"):

a) HEADING OF THE BLOCK:

/blocks/progress/block_progress.php
line 55: $this->title = format_string($this->config->progressTitle);

b) TEXT UNDER PROGRESS BAR (MOUSEOVER)

/blocks/progress/lib.php
line 330: 'name'=>format_string($record->name),

c) EDIT PROGRESS BAR -> NAME OF INSTANCES

/blocks/progress/edit_form.php
line 99: ': <em>'.format_string($instance->name).'</em></strong>');

Activity

Hide
Michael de Raadt added a comment -

Finally getting around to fixing these problems.

Show
Michael de Raadt added a comment - Finally getting around to fixing these problems.
Hide
Michael de Raadt added a comment -

Thanks for helping with this, Dominik.

I've now included these changes in the latested released version.

Show
Michael de Raadt added a comment - Thanks for helping with this, Dominik. I've now included these changes in the latested released version.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: