Moodle
  1. Moodle
  2. MDL-20044

Bullet points in topic summary cause AJAX to fail

    Details

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

      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.

      1. 20091207_mdl_20044.patch
        0.6 kB
        Rossiani Wijaya
      2. 20101029_MDL-20044_HEAD.patch
        0.6 kB
        Rossiani Wijaya

        Issue Links

          Activity

          Hide
          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
          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
          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
          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
          Sam Hemelryk added a comment -

          Hi Rossi, wanna have a look at this

          Show
          Sam Hemelryk added a comment - Hi Rossi, wanna have a look at this
          Hide
          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
          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
          Rossiani Wijaya added a comment -

          committed to 1.9stable

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

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

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

          re-open to fix in 2.0

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

          Attached patch to fix 2.0

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

          Commit patch to 2.0

          Show
          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: