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

Bullet points in topic summary cause AJAX to fail

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.5, 2.0
    • Fix Version/s: 1.9.6, 2.0
    • Component/s: JavaScript
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      Putting bullet points (unordered list) in a topic summary causes the ajax move icons to fail for that topic section. Have only tested this with topics format but assume same applies for weekly format.

      Cheers,
      Shane.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              gmilsted Greg Milsted added a comment -

              This is due to the page being built using <ul> and <li>'s.

              The ajax loads over the page searching for <ul> objects and applying the ajax features (buttons) to resources per topic block.

              The problem is the summary box loads before the actual content div for the topic so when the ajax script comes across the <ul> in the summary box it assumes it has to apply the ajax features to that <ul> but it shouldn't.

              I've modified the following page and it seems to have fixed the issue (and should work even if someone puts lots of <ul>'s in the summary box)


              lib/ajax/section_classes.js
              141: change: this.resources_ul = this.content_td.getElementsByTagName('ul')[0];
              to: this.resources_ul = this.content_td.getElementsByTagName('ul')[0]; var i=0; while (this.resources_ul.className != 'section img-text')

              { i++; this.resources_ul = this.content_td.getElementsByTagName('ul')[i]; }

              It's based on matching the classname of the ul that shapes the page content, I can't assume it will work for every theme but I shouldn't see why a theme would have altered the CSS class for the sections in course/view.php.

              Greg.

              Show
              gmilsted Greg Milsted added a comment - This is due to the page being built using <ul> and <li>'s. The ajax loads over the page searching for <ul> objects and applying the ajax features (buttons) to resources per topic block. The problem is the summary box loads before the actual content div for the topic so when the ajax script comes across the <ul> in the summary box it assumes it has to apply the ajax features to that <ul> but it shouldn't. I've modified the following page and it seems to have fixed the issue (and should work even if someone puts lots of <ul>'s in the summary box) – lib/ajax/section_classes.js 141: change: this.resources_ul = this.content_td.getElementsByTagName('ul') [0] ; to: this.resources_ul = this.content_td.getElementsByTagName('ul') [0] ; var i=0; while (this.resources_ul.className != 'section img-text') { i++; this.resources_ul = this.content_td.getElementsByTagName('ul')[i]; } – It's based on matching the classname of the ul that shapes the page content, I can't assume it will work for every theme but I shouldn't see why a theme would have altered the CSS class for the sections in course/view.php. Greg.
              Hide
              gmilsted Greg Milsted added a comment -

              Alteration:

              If a topic block is empty of content this cause the code to fail - here is the updated version:

              this.resources_ul = this.content_td.getElementsByTagName('ul')[0]; var i=0; while (this.resources_ul && this.resources_ul.className != 'section img-text')

              { i++; this.resources_ul = this.content_td.getElementsByTagName('ul')[i]; }
              Show
              gmilsted Greg Milsted added a comment - Alteration: If a topic block is empty of content this cause the code to fail - here is the updated version: this.resources_ul = this.content_td.getElementsByTagName('ul') [0] ; var i=0; while (this.resources_ul && this.resources_ul.className != 'section img-text') { i++; this.resources_ul = this.content_td.getElementsByTagName('ul')[i]; }
              Hide
              samhemelryk Sam Hemelryk added a comment -

              Hi Rossi, wanna have a look at this

              Show
              samhemelryk Sam Hemelryk added a comment - Hi Rossi, wanna have a look at this
              Hide
              rwijaya Rossiani Wijaya added a comment -

              Greg suggetion fix the issue on my 1.9stable version.

              Thanks Greg from writting the solution for this issue.

              creating patch for the issue.

              Show
              rwijaya Rossiani Wijaya added a comment - Greg suggetion fix the issue on my 1.9stable version. Thanks Greg from writting the solution for this issue. creating patch for the issue.
              Hide
              rwijaya Rossiani Wijaya added a comment -

              committed to 1.9stable

              Show
              rwijaya Rossiani Wijaya added a comment - committed to 1.9stable
              Hide
              samhemelryk Sam Hemelryk added a comment -

              Hi Rossi, does this need to be merged to HEAD?

              Show
              samhemelryk Sam Hemelryk added a comment - Hi Rossi, does this need to be merged to HEAD?
              Hide
              rwijaya Rossiani Wijaya added a comment -

              re-open to fix in 2.0

              Show
              rwijaya Rossiani Wijaya added a comment - re-open to fix in 2.0
              Hide
              rwijaya Rossiani Wijaya added a comment -

              Attached patch to fix 2.0

              Show
              rwijaya Rossiani Wijaya added a comment - Attached patch to fix 2.0
              Hide
              rwijaya Rossiani Wijaya added a comment -

              Commit patch to 2.0

              Show
              rwijaya Rossiani Wijaya added a comment - Commit patch to 2.0

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    21/Oct/09