Moodle
  1. Moodle
  2. MDL-9306

Main course formats need to have tables removed but keep AJAX working

    Details

    • Affected Branches:
      MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      29591

      Description

      The current main course formats currently use tables for layout

      course/format/topics
      course/format/weeks

      which the AJAX course editing functionality (eg Turn Editing on) relies upon (because of the DOM).

      These formats need to to be changed to use a DIV+CSS only structure exactly like

      course/format/weekscss

      And since weekscss will be deprecated it needs to be deleted and all courses using it can be changed to simply "weeks".

      The main issue though is that AJAX will no longer work because of the changed DOM.

      Someone needs to fix the AJAX so that it will work on these formats exactly as it does now.

      1. courseformats.tar
        43 kB
        Ann Adamcik
      2. csscourseformatpatch.txt
        7 kB
        Ann Adamcik
      3. cssformatpatch.txt
        5 kB
        Ann Adamcik
      4. cssformats.tar
        38 kB
        Ann Adamcik
      5. Musik WDH 2CB.doc
        26 kB
        Philipp-Andreas Daniel Kaufmann
      1. moodle2_tableless_course.png
        116 kB

        Issue Links

          Activity

          Hide
          Martin Dougiamas added a comment -

          Don Pinto is keen to work on this.

          Show
          Martin Dougiamas added a comment - Don Pinto is keen to work on this.
          Hide
          John Ryan added a comment -

          I have just downloaded the latest 1.9dev version from moodle.org.

          I have found that the right hand blocks disappear when I turn Editing on if the format is set to topics or weeks but stay if the format is set to weekscss.

          Is this a new bug or simply a work in progress?

          I also find that AJAX no longer works even though it is turned at the site level.

          Show
          John Ryan added a comment - I have just downloaded the latest 1.9dev version from moodle.org. I have found that the right hand blocks disappear when I turn Editing on if the format is set to topics or weeks but stay if the format is set to weekscss. Is this a new bug or simply a work in progress? I also find that AJAX no longer works even though it is turned at the site level.
          Hide
          Martin Dougiamas added a comment -

          Don Pinto, did you have any success with this?

          Show
          Martin Dougiamas added a comment - Don Pinto, did you have any success with this?
          Hide
          AjnabiZ added a comment -

          Any news on this ?

          Show
          AjnabiZ added a comment - Any news on this ?
          Hide
          Ann Adamcik added a comment -

          It doesn't look like this is being worked on, so I'm willing to jump in. I've modified lib/ajax/section_classes.js to work with the weekscss format. I need to do some more testing on it, and then I'll work on creating a css version of the topic format. More next week, I hope...

          Show
          Ann Adamcik added a comment - It doesn't look like this is being worked on, so I'm willing to jump in. I've modified lib/ajax/section_classes.js to work with the weekscss format. I need to do some more testing on it, and then I'll work on creating a css version of the topic format. More next week, I hope...
          Hide
          Ann Adamcik added a comment -

          Attached are new weekscss and topicscss course formats. The second attachment contains patches for lib/ajax/section_classes.js, lang/en_utf8/moodle.php, theme/standard/styles_layout.css, and theme/custom_corners/user_styles.css.

          If the intent is to completely replace the table-based weeks and topics formats with these, then the lang and standard theme changes won't have to be applied. Let me know if this is the case and I will attach new files.

          Show
          Ann Adamcik added a comment - Attached are new weekscss and topicscss course formats. The second attachment contains patches for lib/ajax/section_classes.js, lang/en_utf8/moodle.php, theme/standard/styles_layout.css, and theme/custom_corners/user_styles.css. If the intent is to completely replace the table-based weeks and topics formats with these, then the lang and standard theme changes won't have to be applied. Let me know if this is the case and I will attach new files.
          Hide
          Martin Dougiamas added a comment -

          Oo cool, thanks! Let's get these into HEAD so it gets some thorough testing and if it works well then maybe we can backport to 1.9.1 or something later.

          Show
          Martin Dougiamas added a comment - Oo cool, thanks! Let's get these into HEAD so it gets some thorough testing and if it works well then maybe we can backport to 1.9.1 or something later.
          Hide
          Martin Dougiamas added a comment -

          Yu, can you review these patches and, if good, apply them to HEAD?

          Show
          Martin Dougiamas added a comment - Yu, can you review these patches and, if good, apply them to HEAD?
          Hide
          Martin Dougiamas added a comment -

          Another patch from Ann Nicolas, can you please review and put in HEAD only please (for now)

          Show
          Martin Dougiamas added a comment - Another patch from Ann Nicolas, can you please review and put in HEAD only please (for now)
          Hide
          Nicolas Connault added a comment -

          Applied Ann's patches: all seems to work very well, the output is entirely XHTML compliant, and displays really nicely. The AJAX works very well too.

          Show
          Nicolas Connault added a comment - Applied Ann's patches: all seems to work very well, the output is entirely XHTML compliant, and displays really nicely. The AJAX works very well too.
          Hide
          Nick Freear added a comment -

          Hi Ann,
          Thank you for your work on this - it's moving us forward, which is a big help!

          A question, once these CSS formats have been thoroughly tested and replace the old ones, is the plan to replace layout tables in index.php (and tag/index.php) too? (Probably a new bug.)

          (Just fixed 2 minor bugs: MDL-7878, MDL-11439).
          Regards, Nick Freear (OU)

          Show
          Nick Freear added a comment - Hi Ann, Thank you for your work on this - it's moving us forward, which is a big help! A question, once these CSS formats have been thoroughly tested and replace the old ones, is the plan to replace layout tables in index.php (and tag/index.php) too? (Probably a new bug.) (Just fixed 2 minor bugs: MDL-7878 , MDL-11439 ). Regards, Nick Freear (OU)
          Hide
          Martin Dougiamas added a comment - - edited

          Nicolas, can you please fix this checkin so that the formats replace weeks and topics (and get rid of weekscss and topicscss).

          You'll also need an upgrade like:

          UPDATE course SET format = 'weeks' WHERE format = 'weekscss'

          to clear up any older courses that might be using the defunct format.

          (note also that the changes to lib/ajax probably broke AJAX for the table-based layouts ... check that nothing else was affected).

          Show
          Martin Dougiamas added a comment - - edited Nicolas, can you please fix this checkin so that the formats replace weeks and topics (and get rid of weekscss and topicscss). You'll also need an upgrade like: UPDATE course SET format = 'weeks' WHERE format = 'weekscss' to clear up any older courses that might be using the defunct format. (note also that the changes to lib/ajax probably broke AJAX for the table-based layouts ... check that nothing else was affected).
          Hide
          Martin Dougiamas added a comment -

          Nick F, yes indeed, we should lose the tables in those places as well as My Moodle and Admin pages. But I remain to be convinced that we are free from ugly text-overflowing-out-of-divs problems.

          Show
          Martin Dougiamas added a comment - Nick F, yes indeed, we should lose the tables in those places as well as My Moodle and Admin pages. But I remain to be convinced that we are free from ugly text-overflowing-out-of-divs problems.
          Hide
          Ann Adamcik added a comment -

          Nick & Martin -

          I've attached new css weeks and topics formats that can replace the old weeks and topics directories. For consistency, I changed class names from weekscss* and topicscss* to weeks* and topics*.

          I did attempt to make the ajax changes in such a way that the topics formats would continue to work, but more testing is always a good thing.

          -Ann

          Show
          Ann Adamcik added a comment - Nick & Martin - I've attached new css weeks and topics formats that can replace the old weeks and topics directories. For consistency, I changed class names from weekscss* and topicscss* to weeks* and topics*. I did attempt to make the ajax changes in such a way that the topics formats would continue to work, but more testing is always a good thing. -Ann
          Hide
          Nicolas Connault added a comment -

          Finished all these tasks, seems to be working OK.

          Show
          Nicolas Connault added a comment - Finished all these tasks, seems to be working OK.
          Hide
          Urs Hunkler added a comment -

          Ann and Nick,

          the custom_corners theme is a Chameleon engine enabled theme. You must not write hooks as comma separated lists of elements like "td#middle-column div.bt, div#middle-column div.bt" in Chameleon themes because the Chameleon engine can't handle these comma lists.

          Please write two declarations instead. I correct those properties now.

          Show
          Urs Hunkler added a comment - Ann and Nick, the custom_corners theme is a Chameleon engine enabled theme. You must not write hooks as comma separated lists of elements like "td#middle-column div.bt, div#middle-column div.bt" in Chameleon themes because the Chameleon engine can't handle these comma lists. Please write two declarations instead. I correct those properties now.
          Hide
          Petr Škoda added a comment -

          This is not good - if you compare the course page and any blocks you will see that the size and color is different

          Show
          Petr Škoda added a comment - This is not good - if you compare the course page and any blocks you will see that the size and color is different
          Hide
          Martin Dougiamas added a comment -

          Urs, can that be documented please in the Chameleon themes?

          Show
          Martin Dougiamas added a comment - Urs, can that be documented please in the Chameleon themes?
          Hide
          Petr Škoda added a comment -

          Another big problem is the code in upgrade.php - we must not make HEAD specific upgrades yet because we still have the same version numbers in 19 and head.
          The upgrade code will NOT be executed during upgrade from MOODLE_19_STABLE to HEAD!
          This can not be fixed now, we must wait untill we separate the versions - please no HEAD specific changes in upgrade.php yet

          Show
          Petr Škoda added a comment - Another big problem is the code in upgrade.php - we must not make HEAD specific upgrades yet because we still have the same version numbers in 19 and head. The upgrade code will NOT be executed during upgrade from MOODLE_19_STABLE to HEAD! This can not be fixed now, we must wait untill we separate the versions - please no HEAD specific changes in upgrade.php yet
          Hide
          Urs Hunkler added a comment -

          Another issue: When for example the left column contains no blocks the column does show up empty. Should behave like the table version.

          Show
          Urs Hunkler added a comment - Another issue: When for example the left column contains no blocks the column does show up empty. Should behave like the table version.
          Hide
          Urs Hunkler added a comment -

          Seeing all these issues I urgently recommend not to replace the table course formats but to add the table-less formats and let people change the course format by hand. I expect several courses breaking when the table-less format automatically replaces the table format.

          Show
          Urs Hunkler added a comment - Seeing all these issues I urgently recommend not to replace the table course formats but to add the table-less formats and let people change the course format by hand. I expect several courses breaking when the table-less format automatically replaces the table format.
          Hide
          Urs Hunkler added a comment -

          Explanation added for hooks as comma separated lists in Chameleon in README.html

          Show
          Urs Hunkler added a comment - Explanation added for hooks as comma separated lists in Chameleon in README.html
          Hide
          Matthew Cannings added a comment -

          The blocks_have_content function can be used to adjust the width of the middle column when left or right column is empty

          echo '<div id="middle-column" style="';
          if (!blocks_have_content($pageblocks, BLOCK_POS_LEFT) && !$editing)

          { echo 'margin-left:0;'; }

          if (!blocks_have_content($pageblocks, BLOCK_POS_RIGHT) && !$editing)

          { echo 'margin-right:0;'; }

          echo '">';

          Show
          Matthew Cannings added a comment - The blocks_have_content function can be used to adjust the width of the middle column when left or right column is empty echo '<div id="middle-column" style="'; if (!blocks_have_content($pageblocks, BLOCK_POS_LEFT) && !$editing) { echo 'margin-left:0;'; } if (!blocks_have_content($pageblocks, BLOCK_POS_RIGHT) && !$editing) { echo 'margin-right:0;'; } echo '">';
          Hide
          Nate Baxley added a comment -

          What is the current status of this issue? I would like to turn on the AJAX drag and drop for our new format that is based on the Weekly CSS/No Tables format. Is this currently possible? I have enabled all the admin AJAX settings and in the user profile as well. It appears that moving the course from Weekly format to Weekly CSS format disables the AJAX drag and drop. What is the planned version for adding drag and drop to the CSS formats?

          Show
          Nate Baxley added a comment - What is the current status of this issue? I would like to turn on the AJAX drag and drop for our new format that is based on the Weekly CSS/No Tables format. Is this currently possible? I have enabled all the admin AJAX settings and in the user profile as well. It appears that moving the course from Weekly format to Weekly CSS format disables the AJAX drag and drop. What is the planned version for adding drag and drop to the CSS formats?
          Hide
          Wen Hao Chuang added a comment -

          Sorry for the quick question, we are evaluating the course area AJAX feature right now in 1.9.4. Is this issue (MDL-9306) only affect moodle 1.8.x or does it also affect 1.9.x? Thanks!

          Show
          Wen Hao Chuang added a comment - Sorry for the quick question, we are evaluating the course area AJAX feature right now in 1.9.4. Is this issue ( MDL-9306 ) only affect moodle 1.8.x or does it also affect 1.9.x? Thanks!
          Hide
          Martin Dougiamas added a comment -

          AJAX is working fine for me in 2.0

          Show
          Martin Dougiamas added a comment - AJAX is working fine for me in 2.0

            People

            • Votes:
              7 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: